From ece8289aaff8453ce4e2d61620c55494497fe2ae Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 25 Mar 2015 01:20:41 +0900 Subject: [PATCH] nghttpx: Forward only "trailers" keyword in te when forwarding HTTP/2 backend --- src/shrpx_http2_downstream_connection.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shrpx_http2_downstream_connection.cc b/src/shrpx_http2_downstream_connection.cc index 974c5fd6..d8d83d73 100644 --- a/src/shrpx_http2_downstream_connection.cc +++ b/src/shrpx_http2_downstream_connection.cc @@ -407,8 +407,11 @@ int Http2DownstreamConnection::push_request_headers() { } auto te = downstream_->get_request_header(http2::HD_TE); - if (te) { - nva.push_back(http2::make_nv_ls("te", te->value)); + // HTTP/1 upstream request can contain keyword other than + // "trailers". We just forward "trailers". + // TODO more strict handling required here. + if (te && util::strifind(te->value.c_str(), "trailers")) { + nva.push_back(http2::make_nv_ll("te", "trailers")); } if (LOG_ENABLED(INFO)) {