fix superfluous \r\n after body
Fork of mbed-http by
Diff: source/http_response.h
- Revision:
- 14:3004056e4661
- Parent:
- 9:1289162d9530
- Child:
- 15:ffc77f212382
--- a/source/http_response.h Thu Mar 30 12:53:43 2017 +0200
+++ b/source/http_response.h Thu Mar 30 15:13:37 2017 +0200
@@ -111,6 +111,11 @@
}
void set_body(const char *at, size_t length) {
+ // Connection: close, could not specify Content-Length, nor chunked... So do it like this:
+ if (expected_content_length == 0 && length > 0) {
+ is_chunked = true;
+ }
+
// only malloc when this fn is called, so we don't alloc when body callback's are enabled
if (body == NULL && !is_chunked) {
body = (char*)malloc(expected_content_length);
