From 42eeebc7f6de24166113c9f3c56114344e25b746 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 8 Mar 2015 17:32:38 +0900 Subject: [PATCH] nghttpx: Add function to send trailer part in h1 frontend --- src/shrpx_https_upstream.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shrpx_https_upstream.cc b/src/shrpx_https_upstream.cc index 15dd6699..1020adb1 100644 --- a/src/shrpx_https_upstream.cc +++ b/src/shrpx_https_upstream.cc @@ -780,7 +780,16 @@ int HttpsUpstream::on_downstream_body(Downstream *downstream, int HttpsUpstream::on_downstream_body_complete(Downstream *downstream) { if (downstream->get_chunked_response()) { auto output = downstream->get_response_buf(); - output->append("0\r\n\r\n"); + auto &trailers = downstream->get_response_trailers(); + if (trailers.empty()) { + output->append("0\r\n\r\n"); + } else { + output->append("0\r\n"); + std::string trailer_part; + http2::build_http1_headers_from_headers(trailer_part, trailers); + output->append(trailer_part.c_str(), trailer_part.size()); + output->append("\r\n"); + } } if (LOG_ENABLED(INFO)) { DLOG(INFO, downstream) << "HTTP response completed";