mbed-http

Fork of mbed-http by sandbox

Revision:
3:8a6b003e3874
Parent:
0:910f5949759f
Child:
7:2e3eedb9ca5c
--- a/source/http_request.h	Thu Feb 16 13:55:05 2017 +0100
+++ b/source/http_request.h	Thu Feb 23 13:28:07 2017 +0100
@@ -127,6 +127,7 @@
         // TCPSocket::recv is called until we don't have any data anymore
         nsapi_size_or_error_t recv_ret;
         while ((recv_ret = socket.recv(recv_buffer, HTTP_RECEIVE_BUFFER_SIZE)) > 0) {
+
             // Pass the chunk into the http_parser
             size_t nparsed = parser.execute((const char*)recv_buffer, recv_ret);
             if (nparsed != recv_ret) {
@@ -135,8 +136,8 @@
                 free(recv_buffer);
                 return NULL;
             }
-            // No more chunks? break out of this loop
-            if (recv_ret < HTTP_RECEIVE_BUFFER_SIZE) {
+
+            if (response->is_body_complete()) {
                 break;
             }
         }