@@ -25,7 +25,7 @@ AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer *s, AsyncClient *c)
2525 : _client(c), _server(s), _handler(NULL ), _response(NULL ), _onDisconnectfn(NULL ), _temp(), _parseState(PARSE_REQ_START ), _version(0 ), _method(HTTP_ANY ),
2626 _url(), _host(), _contentType(), _boundary(), _authorization(), _reqconntype(RCT_HTTP ), _authMethod(AsyncAuthType::AUTH_NONE ), _isMultipart(false ),
2727 _isPlainPost(false ), _expectingContinue(false ), _contentLength(0 ), _parsedLength(0 ), _multiParseState(0 ), _boundaryPosition(0 ), _itemStartIndex(0 ),
28- _itemSize(0 ), _itemName(), _itemFilename(), _itemType(), _itemValue(), _itemBuffer(0 ), _itemBufferIndex(0 ), _itemIsFile(false ), _tempObject(NULL ) {
28+ _itemSize(0 ), _itemName(), _itemFilename(), _itemType(), _itemValue(), _itemBuffer(0 ), _itemBufferIndex(0 ), _itemIsFile(false ), _tempObject(NULL ), _rx_timeout( ASYNCWEBSERVER_RX_TIMEOUT ) {
2929 c->onError (
3030 [](void *r, AsyncClient *c, int8_t error) {
3131 (void )c;
@@ -720,7 +720,6 @@ void AsyncWebServerRequest::_send() {
720720 }
721721
722722 // here, we either have a response give nfrom user or one of the two above
723- _client->setRxTimeout (0 );
724723 _response->_respond (this );
725724 _sent = true ;
726725 }
@@ -730,6 +729,7 @@ AsyncWebServerRequestPtr AsyncWebServerRequest::pause() {
730729 if (_paused) {
731730 return _this;
732731 }
732+ _rx_timeout = client ()->getRxTimeout (); // backup client rx timeout
733733 client ()->setRxTimeout (0 );
734734 // this shared ptr will hold the request pointer until it gets destroyed following a disconnect.
735735 // this is just used as a holder providing weak observers, so the deleter is a no-op.
@@ -937,6 +937,7 @@ void AsyncWebServerRequest::send(AsyncWebServerResponse *response) {
937937 // if request was paused, we need to send the response now
938938 if (_paused) {
939939 _paused = false ;
940+ _client->setRxTimeout (_rx_timeout); // restore rx timeout
940941 _send ();
941942 }
942943}
0 commit comments