nghttpx: Fix crash on non-final response from backend server

This commit is contained in:
Tatsuhiro Tsujikawa 2015-11-13 23:59:36 +09:00
parent c6ef1c02b9
commit fe8720341d
1 changed files with 4 additions and 2 deletions

View File

@ -1471,9 +1471,9 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) {
nva.push_back(http2::make_nv_ls(":status", response_status)); 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()) { if (downstream->get_non_final_response()) {
http2::copy_headers_to_nva(nva, downstream->get_response_headers());
if (LOG_ENABLED(INFO)) { if (LOG_ENABLED(INFO)) {
log_response_headers(downstream, nva); log_response_headers(downstream, nva);
} }
@ -1492,6 +1492,8 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) {
return 0; return 0;
} }
http2::copy_headers_to_nva_nocopy(nva, downstream->get_response_headers());
if (!get_config()->http2_proxy && !get_config()->client_proxy) { if (!get_config()->http2_proxy && !get_config()->client_proxy) {
nva.push_back( nva.push_back(
http2::make_nv_lc_nocopy("server", get_config()->server_name)); http2::make_nv_lc_nocopy("server", get_config()->server_name));