From 208dfec4cf79794547a897bdb1c79a55f8e269f7 Mon Sep 17 00:00:00 2001 From: Park0 Date: Sun, 28 Jun 2020 11:52:27 +0200 Subject: [PATCH 1/2] ContentLength can go over 2 byte int Converted int to long to allow for more then 65535 bytes in length --- src/HttpClient.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/HttpClient.h b/src/HttpClient.h index 38fd799..b9f68f8 100644 --- a/src/HttpClient.h +++ b/src/HttpClient.h @@ -272,7 +272,7 @@ public: @return Length of the body, in bytes, or kNoContentLengthHeader if no Content-Length header was returned by the server */ - int contentLength(); + long contentLength(); /** Returns if the response body is chunked @return true if response body is chunked, false otherwise @@ -372,7 +372,7 @@ protected: // Stores the status code for the response, once known int iStatusCode; // Stores the value of the Content-Length header, if present - int iContentLength; + long iContentLength; // How many bytes of the response body have been read by the user int iBodyLengthConsumed; // How far through a Content-Length header prefix we are From 0fac9f0033de4e1f45a9e2d2a28d326c94354163 Mon Sep 17 00:00:00 2001 From: Park0 Date: Sun, 28 Jun 2020 11:53:31 +0200 Subject: [PATCH 2/2] ContentLength can go over 2 byte int Converted int to long to allow for more then 65535 bytes in length --- src/HttpClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HttpClient.cpp b/src/HttpClient.cpp index 7517eea..33ac681 100644 --- a/src/HttpClient.cpp +++ b/src/HttpClient.cpp @@ -542,7 +542,7 @@ bool HttpClient::endOfHeadersReached() return (iState == eReadingBody || iState == eReadingChunkLength || iState == eReadingBodyChunk); }; -int HttpClient::contentLength() +long HttpClient::contentLength() { // skip the response headers, if they haven't been read already if (!endOfHeadersReached())