1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-10-22 10:52:21 +03:00

Add connection keep alive support

This commit is contained in:
Sandeep Mistry
2016-06-17 14:18:11 -04:00
parent 33804d4534
commit bfedff87c1
2 changed files with 64 additions and 20 deletions

View File

@@ -48,6 +48,8 @@ public:
HttpClient(Client& aClient, const String& aServerName, uint16_t aServerPort = kHttpPort);
HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);
void connectionKeepAlive();
/** Start a more complex request.
Use this when you need to send additional headers in the request,
but you will also need to call endRequest() when you are finished.
@@ -247,6 +249,10 @@ protected:
*/
void finishHeaders();
/** Reading any pending data from the client (used in connection keep alive mode)
*/
void flushClientRx();
// Number of milliseconds that we wait each time there isn't any data
// available to be read (during status code and header processing)
static const int kHttpWaitForDataDelay = 1000;
@@ -284,6 +290,7 @@ protected:
// How far through a Content-Length header prefix we are
const char* iContentLengthPtr;
uint32_t iHttpResponseTimeout;
bool iConnectionClose;
String iHeaderLine;
};