trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject [trafficserver] branch master updated: Close the connection when returning a 400 error response
Date Wed, 28 Feb 2018 23:15:09 GMT
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 <bcall@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.

Mime
View raw message