Skip to content

Commit 94b3f41

Browse files
committed
ESP8266WebServer: set write timeout before sending content
1 parent 2ebfed4 commit 94b3f41

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ void ESP8266WebServer::handleClient() {
193193
_currentStatus = HC_NONE;
194194
return;
195195
}
196-
196+
_currentClient.setTimeout(HTTP_MAX_SEND_WAIT);
197197
_contentLength = CONTENT_LENGTH_NOT_SET;
198198
_handleRequest();
199199

@@ -270,7 +270,6 @@ void ESP8266WebServer::send(int code, const char* content_type, const String& co
270270
String header;
271271
_prepareHeader(header, code, content_type, content.length());
272272
sendContent(header);
273-
274273
sendContent(content);
275274
}
276275

libraries/ESP8266WebServer/src/ESP8266WebServer.h

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE };
3434
#define HTTP_DOWNLOAD_UNIT_SIZE 1460
3535
#define HTTP_UPLOAD_BUFLEN 2048
3636
#define HTTP_MAX_DATA_WAIT 1000 //ms to wait for the client to send the request
37+
#define HTTP_MAX_SEND_WAIT 5000 //ms to wait for data chunk to be ACKed
3738
#define HTTP_MAX_CLOSE_WAIT 2000 //ms to wait for the client to close the connection
3839

3940
#define CONTENT_LENGTH_UNKNOWN ((size_t) -1)

0 commit comments

Comments
 (0)