diff --git a/src/HttpClient.cpp b/src/HttpClient.cpp index 1c73464..5b07fd7 100644 --- a/src/HttpClient.cpp +++ b/src/HttpClient.cpp @@ -40,6 +40,7 @@ void HttpClient::resetState() iIsChunked = false; iChunkLength = 0; iHttpResponseTimeout = kHttpResponseTimeout; + iHttpWaitForDataDelay = kHttpWaitForDataDelay; } void HttpClient::stop() @@ -473,7 +474,7 @@ int HttpClient::responseStatusCode() { // We haven't got any data, so let's pause to allow some to // arrive - delay(kHttpWaitForDataDelay); + delay(iHttpWaitForDataDelay); } } if ( (c == '\n') && (iStatusCode < 200 && iStatusCode != 101) ) @@ -522,7 +523,7 @@ int HttpClient::skipResponseHeaders() { // We haven't got any data, so let's pause to allow some to // arrive - delay(kHttpWaitForDataDelay); + delay(iHttpWaitForDataDelay); } } if (endOfHeadersReached()) diff --git a/src/HttpClient.h b/src/HttpClient.h index 6a7aa1d..cf24d96 100644 --- a/src/HttpClient.h +++ b/src/HttpClient.h @@ -317,6 +317,8 @@ class HttpClient : public Client virtual operator bool() { return bool(iClient); }; virtual uint32_t httpResponseTimeout() { return iHttpResponseTimeout; }; virtual void setHttpResponseTimeout(uint32_t timeout) { iHttpResponseTimeout = timeout; }; + virtual uint32_t httpWaitForDataDelay() { return iHttpWaitForDataDelay; }; + virtual void setHttpWaitForDataDelay(uint32_t delay) { iHttpWaitForDataDelay = delay; }; protected: /** Reset internal state data back to the "just initialised" state */ @@ -384,6 +386,7 @@ class HttpClient : public Client // Stores the value of the current chunk length, if present int iChunkLength; uint32_t iHttpResponseTimeout; + uint32_t iHttpWaitForDataDelay; bool iConnectionClose; bool iSendDefaultRequestHeaders; String iHeaderLine;