Experimental HTTP and HTTPS library for mbed OS 5
Revision 14:3004056e4661, committed 2017-03-30
- Comitter:
- Jan Jongboom
- Date:
- Thu Mar 30 15:13:37 2017 +0200
- Parent:
- 13:992d953ecfb9
- Child:
- 15:ffc77f212382
- Commit message:
- Request with a body, but without Content-Length header should pretend it's chunked to allocate enough memory
Changed in this revision
| source/http_response.h | Show annotated file Show diff for this revision Revisions of this file |
--- 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);