Skip to content

Commit

Permalink
Ensure that HTTP/1.0 or Connection: close headers are properly discon…
Browse files Browse the repository at this point in the history
…necting the client

Test results: #6514 (comment)

fixes #6514
  • Loading branch information
Michael Friedrich committed Oct 9, 2018
1 parent 051b3ba commit 13239c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/remote/httpresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ void HttpResponse::Finish()
}

m_State = HttpResponseEnd;

if (m_Request->ProtocolVersion == HttpVersion10 || m_Request->Headers->Get("connection") == "close")
m_Stream->Shutdown();
}

bool HttpResponse::Parse(StreamReadContext& src, bool may_wait)
Expand Down
7 changes: 7 additions & 0 deletions lib/remote/httpserverconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ void HttpServerConnection::DataAvailableHandler()
}

m_RequestQueue.Enqueue(std::bind(&Stream::SetCorked, m_Stream, false));

/* Request finished, decide whether to explicitly close the connection. */
if (m_CurrentRequest.ProtocolVersion == HttpVersion10 ||
m_CurrentRequest.Headers->Get("connection") == "close") {
m_Stream->Shutdown();
close = true;
}
} else
close = true;

Expand Down

0 comments on commit 13239c3

Please sign in to comment.