Fork of mbed-http
Fork of mbed-http by
Revision 13:efe5c8b16dab, committed 2017-03-29
- Comitter:
- Matthew Else
- Date:
- Wed Mar 29 16:52:54 2017 +0100
- Parent:
- 12:530c2ebee349
- Child:
- 14:5f9acddaa0a4
- Commit message:
- Auto-detect chunked HTTP requests
Changed in this revision
source/http_request.h | Show annotated file Show diff for this revision Revisions of this file |
source/http_response.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/http_request.h Tue Mar 28 14:47:51 2017 +0200 +++ b/source/http_request.h Wed Mar 29 16:52:54 2017 +0100 @@ -147,6 +147,7 @@ // Create a response object response = new HttpResponse(); + // response->set_chunked(); // And a response parser HttpResponseParser parser(response, body_callback); @@ -166,6 +167,10 @@ return NULL; } + if (response->get_expected_content_length() == 0) { + response->set_chunked(); + } + if (response->is_message_complete()) { break; }
--- a/source/http_response.h Tue Mar 28 14:47:51 2017 +0200 +++ b/source/http_response.h Wed Mar 29 16:52:54 2017 +0100 @@ -159,6 +159,10 @@ is_message_completed = true; } + size_t get_expected_content_length() { + return expected_content_length; + } + private: // from http://stackoverflow.com/questions/5820810/case-insensitive-string-comp-in-c int strcicmp(char const *a, char const *b) {