nghttpx: Close API request connection for 400 and 413 response

This commit is contained in:
Tatsuhiro Tsujikawa 2016-06-04 17:43:48 +09:00
parent 851cbd49f4
commit 92db6820d8
1 changed files with 9 additions and 0 deletions

View File

@ -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;
}