Skip to content

Commit

Permalink
Be lenient about Connection header contents when Upgrade header is pr…
Browse files Browse the repository at this point in the history
…esent

This is a workaround for rstudio/rstudio#2940. It
stops an erroneously sent "Connection: close" header from breaking an
otherwise legit websocket request.
  • Loading branch information
jcheng5 committed Jun 8, 2018
1 parent 4be7206 commit 1454f45
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/httprequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ int HttpRequest::_on_message_complete(http_parser* pParser) {
ASSERT_BACKGROUND_THREAD()
trace("HttpRequest::_on_message_complete");

if (pParser->upgrade)
if (pParser->upgrade || (pParser->flags & F_UPGRADE))
return 0;

boost::function<void(boost::shared_ptr<HttpResponse>)> schedule_bg_callback(
Expand Down Expand Up @@ -706,7 +706,7 @@ void HttpRequest::_parse_http_data(char* buffer, const ssize_t n) {
// buffer.
_requestBuffer.insert(_requestBuffer.end(), buffer + parsed, buffer + n);

} else if (_parser.upgrade) {
} else if (_parser.upgrade || (_parser.flags & F_UPGRADE)) {
char* pData = buffer + parsed;
size_t pDataLen = n - parsed;

Expand Down

0 comments on commit 1454f45

Please sign in to comment.