Skip to content

Commit

Permalink
Close the connection when returning a 400 error response
Browse files Browse the repository at this point in the history
  • Loading branch information
bryancall committed Feb 28, 2018
1 parent 2075a92 commit fe9c127
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions proxy/http/HttpTransact.cc
Expand Up @@ -7814,6 +7814,11 @@ HttpTransact::build_error_response(State *s, HTTPStatus status_code, const char
s->client_info.keep_alive = HTTP_NO_KEEPALIVE;
}

// If there is a parse error on reading the request it can leave reading the request stream in an undetermined state
if (status_code == HTTP_STATUS_BAD_REQUEST) {
s->client_info.keep_alive = HTTP_NO_KEEPALIVE;
}

switch (status_code) {
case HTTP_STATUS_BAD_REQUEST:
SET_VIA_STRING(VIA_CLIENT_REQUEST, VIA_CLIENT_ERROR);
Expand Down
2 changes: 1 addition & 1 deletion tests/gold_tests/headers/syntax.400.gold
@@ -1,4 +1,4 @@
HTTP/1.1 400 Invalid HTTP Request
Date: ``
Connection: keep-alive
Connection: close
Server: ``

0 comments on commit fe9c127

Please sign in to comment.