mirror of
https://github.com/arduino-libraries/ArduinoHttpClient.git
synced 2025-04-19 21:22:15 +03:00
Merge pull request #158 from AnCaPepe/AnCaPepe-custom-wait-delay
Add ability to set response wait time
This commit is contained in:
commit
5c5fafb4e8
@ -40,6 +40,7 @@ void HttpClient::resetState()
|
|||||||
iIsChunked = false;
|
iIsChunked = false;
|
||||||
iChunkLength = 0;
|
iChunkLength = 0;
|
||||||
iHttpResponseTimeout = kHttpResponseTimeout;
|
iHttpResponseTimeout = kHttpResponseTimeout;
|
||||||
|
iHttpWaitForDataDelay = kHttpWaitForDataDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpClient::stop()
|
void HttpClient::stop()
|
||||||
@ -473,7 +474,7 @@ int HttpClient::responseStatusCode()
|
|||||||
{
|
{
|
||||||
// We haven't got any data, so let's pause to allow some to
|
// We haven't got any data, so let's pause to allow some to
|
||||||
// arrive
|
// arrive
|
||||||
delay(kHttpWaitForDataDelay);
|
delay(iHttpWaitForDataDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( (c == '\n') && (iStatusCode < 200 && iStatusCode != 101) )
|
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
|
// We haven't got any data, so let's pause to allow some to
|
||||||
// arrive
|
// arrive
|
||||||
delay(kHttpWaitForDataDelay);
|
delay(iHttpWaitForDataDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (endOfHeadersReached())
|
if (endOfHeadersReached())
|
||||||
|
@ -317,6 +317,8 @@ public:
|
|||||||
virtual operator bool() { return bool(iClient); };
|
virtual operator bool() { return bool(iClient); };
|
||||||
virtual uint32_t httpResponseTimeout() { return iHttpResponseTimeout; };
|
virtual uint32_t httpResponseTimeout() { return iHttpResponseTimeout; };
|
||||||
virtual void setHttpResponseTimeout(uint32_t timeout) { iHttpResponseTimeout = timeout; };
|
virtual void setHttpResponseTimeout(uint32_t timeout) { iHttpResponseTimeout = timeout; };
|
||||||
|
virtual uint32_t httpWaitForDataDelay() { return iHttpWaitForDataDelay; };
|
||||||
|
virtual void setHttpWaitForDataDelay(uint32_t delay) { iHttpWaitForDataDelay = delay; };
|
||||||
protected:
|
protected:
|
||||||
/** Reset internal state data back to the "just initialised" state
|
/** Reset internal state data back to the "just initialised" state
|
||||||
*/
|
*/
|
||||||
@ -384,6 +386,7 @@ protected:
|
|||||||
// Stores the value of the current chunk length, if present
|
// Stores the value of the current chunk length, if present
|
||||||
int iChunkLength;
|
int iChunkLength;
|
||||||
uint32_t iHttpResponseTimeout;
|
uint32_t iHttpResponseTimeout;
|
||||||
|
uint32_t iHttpWaitForDataDelay;
|
||||||
bool iConnectionClose;
|
bool iConnectionClose;
|
||||||
bool iSendDefaultRequestHeaders;
|
bool iSendDefaultRequestHeaders;
|
||||||
String iHeaderLine;
|
String iHeaderLine;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user