Skip to content

Commit

Permalink
Restore 'Connection: close' behaviour in HTTP responses
Browse files Browse the repository at this point in the history
Actually the `corked` functionality caused problems with
not closing connections properly.

Full Analysis: #6799 (comment)

Full credits to @swegener :)

fixes #6799
  • Loading branch information
swegener authored and Michael Friedrich committed Dec 5, 2018
1 parent 18de1f7 commit 080f666
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 3 additions & 0 deletions lib/remote/httpresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ 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: 0 additions & 7 deletions lib/remote/httpserverconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,6 @@ void HttpServerConnection::DataAvailableHandler()

close = true;
}

/* 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 080f666

Please sign in to comment.