Skip to content

Commit 7a439b4

Browse files
committed
ESP8266WebServer: set write timeout before sending content
1 parent fa3df0d commit 7a439b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

Lines changed: 1 addition & 2 deletions
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

@@ -273,7 +273,6 @@ void ESP8266WebServer::send(int code, const char* content_type, const String& co
273273
String header;
274274
_prepareHeader(header, code, content_type, content.length());
275275
sendContent(header);
276-
277276
sendContent(content);
278277
}
279278

libraries/ESP8266WebServer/src/ESP8266WebServer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ enum HTTPClientStatus { HC_NONE, HC_WAIT_READ, HC_WAIT_CLOSE };
3636
#define HTTP_UPLOAD_BUFLEN 2048
3737
#define HTTP_MAX_DATA_WAIT 1000 //ms to wait for the client to send the request
3838
#define HTTP_MAX_POST_WAIT 1000 //ms to wait for POST data to arrive
39+
#define HTTP_MAX_SEND_WAIT 5000 //ms to wait for data chunk to be ACKed
3940
#define HTTP_MAX_CLOSE_WAIT 2000 //ms to wait for the client to close the connection
4041

4142
#define CONTENT_LENGTH_UNKNOWN ((size_t) -1)

0 commit comments

Comments
 (0)