From fe8720341d3d2c486a1aaceef63039cdeecbb77f Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 13 Nov 2015 23:59:36 +0900 Subject: [PATCH] nghttpx: Fix crash on non-final response from backend server --- src/shrpx_http2_upstream.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index 1c6af673..42a347fb 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -1471,9 +1471,9 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { nva.push_back(http2::make_nv_ls(":status", response_status)); } - http2::copy_headers_to_nva_nocopy(nva, downstream->get_response_headers()); - if (downstream->get_non_final_response()) { + http2::copy_headers_to_nva(nva, downstream->get_response_headers()); + if (LOG_ENABLED(INFO)) { log_response_headers(downstream, nva); } @@ -1492,6 +1492,8 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) { return 0; } + http2::copy_headers_to_nva_nocopy(nva, downstream->get_response_headers()); + if (!get_config()->http2_proxy && !get_config()->client_proxy) { nva.push_back( http2::make_nv_lc_nocopy("server", get_config()->server_name));