mirror of
https://github.com/arduino-libraries/ArduinoHttpClient.git
synced 2025-04-19 21:22:15 +03:00
commit
ce4d50b898
@ -48,6 +48,7 @@ void HttpClient::resetState()
|
|||||||
iContentLength = 0;
|
iContentLength = 0;
|
||||||
iBodyLengthConsumed = 0;
|
iBodyLengthConsumed = 0;
|
||||||
iContentLengthPtr = 0;
|
iContentLengthPtr = 0;
|
||||||
|
iHttpResponseTimeout = kHttpResponseTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpClient::stop()
|
void HttpClient::stop()
|
||||||
@ -311,7 +312,7 @@ int HttpClient::responseStatusCode()
|
|||||||
const char* statusPtr = statusPrefix;
|
const char* statusPtr = statusPrefix;
|
||||||
// Whilst we haven't timed out & haven't reached the end of the headers
|
// Whilst we haven't timed out & haven't reached the end of the headers
|
||||||
while ((c != '\n') &&
|
while ((c != '\n') &&
|
||||||
( (millis() - timeoutStart) < kHttpResponseTimeout ))
|
( (millis() - timeoutStart) < iHttpResponseTimeout ))
|
||||||
{
|
{
|
||||||
if (available())
|
if (available())
|
||||||
{
|
{
|
||||||
@ -401,7 +402,7 @@ int HttpClient::skipResponseHeaders()
|
|||||||
unsigned long timeoutStart = millis();
|
unsigned long timeoutStart = millis();
|
||||||
// Whilst we haven't timed out & haven't reached the end of the headers
|
// Whilst we haven't timed out & haven't reached the end of the headers
|
||||||
while ((!endOfHeadersReached()) &&
|
while ((!endOfHeadersReached()) &&
|
||||||
( (millis() - timeoutStart) < kHttpResponseTimeout ))
|
( (millis() - timeoutStart) < iHttpResponseTimeout ))
|
||||||
{
|
{
|
||||||
if (available())
|
if (available())
|
||||||
{
|
{
|
||||||
|
@ -370,8 +370,10 @@ public:
|
|||||||
virtual int connect(IPAddress ip, uint16_t port) { return iClient->connect(ip, port); };
|
virtual int connect(IPAddress ip, uint16_t port) { return iClient->connect(ip, port); };
|
||||||
virtual int connect(const char *host, uint16_t port) { return iClient->connect(host, port); };
|
virtual int connect(const char *host, uint16_t port) { return iClient->connect(host, port); };
|
||||||
virtual void stop();
|
virtual void stop();
|
||||||
virtual uint8_t connected() { iClient->connected(); };
|
virtual uint8_t connected() { return iClient->connected(); };
|
||||||
virtual operator bool() { return bool(iClient); };
|
virtual operator bool() { return bool(iClient); };
|
||||||
|
virtual uint32_t httpResponseTimeout() { return iHttpResponseTimeout; };
|
||||||
|
virtual void setHttpResponseTimeout(uint32_t timeout) { iHttpResponseTimeout = timeout; };
|
||||||
protected:
|
protected:
|
||||||
/** Reset internal state data back to the "just initialised" state
|
/** Reset internal state data back to the "just initialised" state
|
||||||
*/
|
*/
|
||||||
@ -434,6 +436,7 @@ protected:
|
|||||||
// Address of the proxy to use, if we're using one
|
// Address of the proxy to use, if we're using one
|
||||||
IPAddress iProxyAddress;
|
IPAddress iProxyAddress;
|
||||||
uint16_t iProxyPort;
|
uint16_t iProxyPort;
|
||||||
|
uint32_t iHttpResponseTimeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user