From 92db6820d86ba9e6fdf5aa997e4fc872400af09e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 4 Jun 2016 17:43:48 +0900 Subject: [PATCH] nghttpx: Close API request connection for 400 and 413 response --- src/shrpx_api_downstream_connection.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/shrpx_api_downstream_connection.cc b/src/shrpx_api_downstream_connection.cc index 14b455c1..ee1eb985 100644 --- a/src/shrpx_api_downstream_connection.cc +++ b/src/shrpx_api_downstream_connection.cc @@ -71,6 +71,15 @@ int APIDownstreamConnection::send_reply(unsigned int http_status, resp.fs.add_header_token(StringRef::from_lit("content-length"), content_length, false, http2::HD_CONTENT_LENGTH); + switch (http_status) { + case 400: + case 413: + resp.fs.add_header_token(StringRef::from_lit("connection"), + StringRef::from_lit("close"), false, + http2::HD_CONNECTION); + break; + } + if (upstream->send_reply(downstream_, body.byte(), body.size()) != 0) { return -1; }