Fix Timeout Bug in WebServer (#2938)

This commit is contained in:
Victor Aprea 2019-07-09 12:27:24 -04:00 committed by Me No Dev
parent d2816b2f32
commit 02e51728c4
2 changed files with 4 additions and 2 deletions

View File

@ -96,7 +96,7 @@ void loop() {
client.setCACert(rootCACertificate); client.setCACert(rootCACertificate);
// Reading data over SSL may be slow, use an adequate timeout // Reading data over SSL may be slow, use an adequate timeout
client.setTimeout(12000); client.setTimeout(12000 / 1000); // timeout argument is defined in seconds for setTimeout
// The line below is optional. It can be used to blink the LED on the board during flashing // The line below is optional. It can be used to blink the LED on the board during flashing
// The LED will be on during download of one buffer of data from the network. The LED will // The LED will be on during download of one buffer of data from the network. The LED will

View File

@ -302,7 +302,9 @@ void WebServer::handleClient() {
// Wait for data from client to become available // Wait for data from client to become available
if (_currentClient.available()) { if (_currentClient.available()) {
if (_parseRequest(_currentClient)) { if (_parseRequest(_currentClient)) {
_currentClient.setTimeout(HTTP_MAX_SEND_WAIT); // because HTTP_MAX_SEND_WAIT is expressed in milliseconds,
// it must be divided by 1000
_currentClient.setTimeout(HTTP_MAX_SEND_WAIT / 1000);
_contentLength = CONTENT_LENGTH_NOT_SET; _contentLength = CONTENT_LENGTH_NOT_SET;
_handleRequest(); _handleRequest();