From 326b4c467b98bff46bea4b25da7aa162be2bfb4d Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 26 May 2015 00:00:11 +0900 Subject: [PATCH] nghttpx: Fix bug that END_STREAM is not set in backend for POST with Upgrade --- src/shrpx_downstream.cc | 4 ++-- src/shrpx_downstream.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shrpx_downstream.cc b/src/shrpx_downstream.cc index 6b7f4a0e..1fc8f854 100644 --- a/src/shrpx_downstream.cc +++ b/src/shrpx_downstream.cc @@ -928,13 +928,13 @@ void Downstream::inspect_http1_request() { if (!upgrade_request_) { auto idx = request_hdidx_[http2::HD_UPGRADE]; if (idx != -1) { - upgrade_request_ = true; - auto &val = request_headers_[idx].value; // TODO Perform more strict checking for upgrade headers if (util::streq_l(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, val.c_str(), val.size())) { http2_upgrade_seen_ = true; + } else { + upgrade_request_ = true; } } } diff --git a/src/shrpx_downstream.h b/src/shrpx_downstream.h index 2bd29312..9cd12ad0 100644 --- a/src/shrpx_downstream.h +++ b/src/shrpx_downstream.h @@ -80,10 +80,11 @@ public: bool request_buf_full(); // Returns true if upgrade (HTTP Upgrade or CONNECT) is succeeded. void check_upgrade_fulfilled(); - // Returns true if the request is upgrade. + // Returns true if the request is upgrade. Upgrade to HTTP/2 is + // excluded. For HTTP/2 Upgrade, check get_http2_upgrade_request(). bool get_upgrade_request() const; // Returns true if the upgrade is succeded as a result of the call - // check_upgrade_fulfilled(). + // check_upgrade_fulfilled(). HTTP/2 Upgrade is excluded. bool get_upgraded() const; // Inspects HTTP/2 request. void inspect_http2_request();