You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2018/03/01 00:05:35 UTC

[trafficserver] branch 7.1.x updated: Close the connection when returning a 400 error response

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

zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


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

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

    Close the connection when returning a 400 error response
    
    (cherry picked from commit fe9c1276aba6768e78b72a486c07e7b853214b09)
---
 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 64cdea3..289a747 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8203,6 +8203,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
zwoop@apache.org.