1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-28 05:01:28 +03:00

WebServer: Allow client to send many requests on the same connection (#7414)

* WebServer: Allow client to send many requests on the same connection

* WebServer: Keep the connection alive with a client by default

* WebServer: Use the request's HTTP version and Connection header to set the default keep alive value

* Fix a typo in a comment
This commit is contained in:
Zakary Kamal Ismail
2020-07-16 16:53:48 -04:00
committed by GitHub
parent 709ba7981e
commit 3c1bd65a76
3 changed files with 30 additions and 2 deletions

View File

@ -168,6 +168,14 @@ public:
sendContent(emptyString);
}
// Whether other requests should be accepted from the client on the
// same socket after a response is sent.
// This will automatically configure the "Connection" header of the response.
// Defaults to true when the client's HTTP version is 1.1 or above, otherwise it defaults to false.
// If the client sends the "Connection" header, the value given by the header is used.
void keepAlive(bool keepAlive) { _keepAlive = keepAlive; }
bool keepAlive() { return _keepAlive; }
static String credentialHash(const String& username, const String& realm, const String& password);
static String urlDecode(const String& text);
@ -224,6 +232,7 @@ protected:
uint8_t _currentVersion;
HTTPClientStatus _currentStatus;
unsigned long _statusChange;
bool _keepAlive;
RequestHandlerType* _currentHandler;
RequestHandlerType* _firstHandler;