Skip to content

Commit 5c5fafb

Browse files
Merge pull request #158 from AnCaPepe/AnCaPepe-custom-wait-delay
Add ability to set response wait time
2 parents 2143747 + c490dde commit 5c5fafb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/HttpClient.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void HttpClient::resetState()
4040
iIsChunked = false;
4141
iChunkLength = 0;
4242
iHttpResponseTimeout = kHttpResponseTimeout;
43+
iHttpWaitForDataDelay = kHttpWaitForDataDelay;
4344
}
4445

4546
void HttpClient::stop()
@@ -473,7 +474,7 @@ int HttpClient::responseStatusCode()
473474
{
474475
// We haven't got any data, so let's pause to allow some to
475476
// arrive
476-
delay(kHttpWaitForDataDelay);
477+
delay(iHttpWaitForDataDelay);
477478
}
478479
}
479480
if ( (c == '\n') && (iStatusCode < 200 && iStatusCode != 101) )
@@ -522,7 +523,7 @@ int HttpClient::skipResponseHeaders()
522523
{
523524
// We haven't got any data, so let's pause to allow some to
524525
// arrive
525-
delay(kHttpWaitForDataDelay);
526+
delay(iHttpWaitForDataDelay);
526527
}
527528
}
528529
if (endOfHeadersReached())

src/HttpClient.h

+3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ class HttpClient : public Client
317317
virtual operator bool() { return bool(iClient); };
318318
virtual uint32_t httpResponseTimeout() { return iHttpResponseTimeout; };
319319
virtual void setHttpResponseTimeout(uint32_t timeout) { iHttpResponseTimeout = timeout; };
320+
virtual uint32_t httpWaitForDataDelay() { return iHttpWaitForDataDelay; };
321+
virtual void setHttpWaitForDataDelay(uint32_t delay) { iHttpWaitForDataDelay = delay; };
320322
protected:
321323
/** Reset internal state data back to the "just initialised" state
322324
*/
@@ -384,6 +386,7 @@ class HttpClient : public Client
384386
// Stores the value of the current chunk length, if present
385387
int iChunkLength;
386388
uint32_t iHttpResponseTimeout;
389+
uint32_t iHttpWaitForDataDelay;
387390
bool iConnectionClose;
388391
bool iSendDefaultRequestHeaders;
389392
String iHeaderLine;

0 commit comments

Comments
 (0)