From 9ffbc45ba6bf6838b08f6d99a6f34f523d7c2785 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 8 Mar 2015 17:58:00 +0900 Subject: [PATCH] nghttpx: Allow sending trailer part in h1 backend link --- src/shrpx_http_downstream_connection.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index 323d2b0e..8630815d 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -403,7 +403,16 @@ int HttpDownstreamConnection::end_upload_data() { } auto output = downstream_->get_request_buf(); - output->append("0\r\n\r\n"); + auto &trailers = downstream_->get_request_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"); + } signal_write();