@@ -14,7 +14,7 @@ HTTPConnection::HTTPConnection(ResourceResolver * resResolver):
1414 _clientState = CSTATE_UNDEFINED ;
1515 _httpHeaders = NULL ;
1616 _defaultHeaders = NULL ;
17- _isKeepAlive = false ;
17+ _isKeepAlive = true ;
1818 _lastTransmissionTS = millis ();
1919 _shutdownTS = 0 ;
2020 _wsHandler = nullptr ;
@@ -44,9 +44,9 @@ int HTTPConnection::initialize(int serverSocketID, HTTPHeaders *defaultHeaders)
4444 refreshTimeout ();
4545 return _socket;
4646 }
47-
47+
4848 HTTPS_LOGE (" Could not accept() new connection" );
49-
49+
5050 _addrLen = 0 ;
5151 _connectionState = STATE_ERROR ;
5252 _clientState = CSTATE_ACTIVE ;
@@ -452,15 +452,15 @@ void HTTPConnection::loop() {
452452 [](unsigned char c){ return ::tolower (c); }
453453 );
454454 }
455- if (std::string (" keep-alive" ).compare (connectionHeaderValue)==0 ) {
456- HTTPS_LOGD (" Keep-Alive activated. FID=%d" , _socket);
457- _isKeepAlive = true ;
458- } else {
455+ if (std::string (" close" ).compare (connectionHeaderValue)==0 ) {
459456 HTTPS_LOGD (" Keep-Alive disabled. FID=%d" , _socket);
460457 _isKeepAlive = false ;
458+ } else {
459+ HTTPS_LOGD (" Keep-Alive activated. FID=%d" , _socket);
460+ _isKeepAlive = true ;
461461 }
462462 } else {
463- _isKeepAlive = false ;
463+ _isKeepAlive = true ;
464464 }
465465
466466 // Create request context
@@ -520,7 +520,7 @@ void HTTPConnection::loop() {
520520 // Finally, after the handshake is done, we create the WebsocketHandler and change the internal state.
521521 if (websocketRequested) {
522522 _wsHandler = ((WebsocketNode*)resolvedResource.getMatchingNode ())->newHandler ();
523- _wsHandler->initialize (this ); // make websocket with this connection
523+ _wsHandler->initialize (this ); // make websocket with this connection
524524 _connectionState = STATE_WEBSOCKET ;
525525 } else {
526526 // Handling the request is done
@@ -680,7 +680,7 @@ std::string websocketKeyResponseHash(std::string const &key) {
680680 (const unsigned char *)shaData,
681681 HTTPS_SHA1_LENGTH
682682 );
683-
683+
684684 // Check result and return the encoded string
685685 if (res != 0 ) {
686686 return std::string ();
0 commit comments