This is an automated email from the ASF dual-hosted git repository.
oknet 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 031f321 The response header of CONNECT should not have content-length
or chunk-encoding
031f321 is described below
commit 031f321be814c71047a700b4b8c507382d51f709
Author: unknown <[email protected]>
AuthorDate: Tue Mar 19 11:18:50 2019 +0800
The response header of CONNECT should not have content-length or
chunk-encoding
---
proxy/http/HttpTransact.h | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 9e2e5e4..af40b15 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -1081,15 +1081,17 @@ public:
typedef void (*TransactEntryFunc_t)(HttpTransact::State *s);
-////////////////////////////////////////////////////////
-// the spec says about message body the following: //
-// All responses to the HEAD request method MUST NOT //
-// include a message-body, even though the presence //
-// of entity-header fields might lead one to believe //
-// they do. All 1xx (informational), 204 (no content),//
-// and 304 (not modified) responses MUST NOT include //
-// a message-body. //
-////////////////////////////////////////////////////////
+/* The spec says about message body the following:
+ *
+ * All responses to the HEAD and CONNECT request method
+ * MUST NOT include a message-body, even though the presence
+ * of entity-header fields might lead one to believe they do.
+ *
+ * All 1xx (informational), 204 (no content), and 304 (not modified)
+ * responses MUST NOT include a message-body.
+ *
+ * Refer : [https://tools.ietf.org/html/rfc7231#section-4.3.6]
+ */
inline bool
is_response_body_precluded(HTTPStatus status_code)
{
@@ -1105,7 +1107,7 @@ is_response_body_precluded(HTTPStatus status_code)
inline bool
is_response_body_precluded(HTTPStatus status_code, int method)
{
- if ((method == HTTP_WKSIDX_HEAD) || is_response_body_precluded(status_code))
{
+ if ((method == HTTP_WKSIDX_HEAD) || (method == HTTP_WKSIDX_CONNECT) ||
is_response_body_precluded(status_code)) {
return true;
} else {
return false;