You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/02/28 23:15:09 UTC

[trafficserver] branch master updated: Close the connection when returning a 400 error response

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new fe9c127  Close the connection when returning a 400 error response
fe9c127 is described below

commit fe9c1276aba6768e78b72a486c07e7b853214b09
Author: Bryan Call <bc...@apache.org>
AuthorDate: Wed Feb 28 14:45:06 2018 -0800

    Close the connection when returning a 400 error response
---
 proxy/http/HttpTransact.cc               | 5 +++++
 tests/gold_tests/headers/syntax.400.gold | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 9867ca1..2d89222 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -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);
diff --git a/tests/gold_tests/headers/syntax.400.gold b/tests/gold_tests/headers/syntax.400.gold
index b2502a6..3c7e4fa 100644
--- a/tests/gold_tests/headers/syntax.400.gold
+++ b/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: ``

-- 
To stop receiving notification emails like this one, please contact
bcall@apache.org.