Skip to content

Commit cf31acb

Browse files
HTTPConnection::loop respects 'keep-alive' value despite the case sensitivity.
1 parent 013436f commit cf31acb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/HTTPConnection.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,12 @@ void HTTPConnection::loop() {
434434
if (resolvedResource.getMatchingNode()->_nodeType == HANDLER_CALLBACK) {
435435
// Did the client set connection:keep-alive?
436436
HTTPHeader * connectionHeader = _httpHeaders->get("Connection");
437-
if (connectionHeader != NULL && std::string("keep-alive").compare(connectionHeader->_value)==0) {
437+
std::string connectionHeaderValue = "";
438+
if (connectionHeader != NULL) {
439+
connectionHeaderValue += connectionHeader->_value;
440+
std::transform(connectionHeaderValue.begin(), connectionHeaderValue.end(), connectionHeaderValue.begin(), ::tolower);
441+
}
442+
if (std::string("keep-alive").compare(connectionHeaderValue)==0) {
438443
HTTPS_DLOGHEX("[ ] Keep-Alive activated. fid=", _socket);
439444
_isKeepAlive = true;
440445
} else {

0 commit comments

Comments
 (0)