From e8053ac9313c0a029580a09fee9f31ef7be80539 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 19 Jan 2015 21:16:47 +0900 Subject: [PATCH] nghttpx: Check Content-Length only when Transfer-Encoding is not found --- src/shrpx_downstream.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc index 9d9c973c..0ec001ce 100644 --- a/src/shrpx_downstream.cc +++ b/src/shrpx_downstream.cc @@ -767,11 +767,14 @@ void Downstream::inspect_http1_response() { chunked_response_ = true; } - idx = response_hdidx_[http2::HD_CONTENT_LENGTH]; - if (idx != -1) { - auto len = util::parse_uint(response_headers_[idx].value); - if (len != -1) { - response_content_length_ = len; + // examine Content-Length only when Transfer-Encoding is missing + if (idx == -1) { + idx = response_hdidx_[http2::HD_CONTENT_LENGTH]; + if (idx != -1) { + auto len = util::parse_uint(response_headers_[idx].value); + if (len != -1) { + response_content_length_ = len; + } } } }