nghttpx: Add connection: close to mruby response in graceful shutdown period

This commit is contained in:
Tatsuhiro Tsujikawa 2016-05-18 01:21:23 +09:00
parent 7a3c656adf
commit 629f1e6f0f
1 changed files with 10 additions and 1 deletions

View File

@ -806,7 +806,16 @@ int HttpsUpstream::send_reply(Downstream *downstream, const uint8_t *body,
auto &balloc = downstream->get_block_allocator(); auto &balloc = downstream->get_block_allocator();
auto connection_close = false; auto connection_close = false;
if (req.http_major <= 0 || (req.http_major == 1 && req.http_minor == 0)) {
auto worker = handler_->get_worker();
if (worker->get_graceful_shutdown()) {
resp.fs.add_header_token(StringRef::from_lit("connection"),
StringRef::from_lit("close"), false,
http2::HD_CONNECTION);
connection_close = true;
} else if (req.http_major <= 0 ||
(req.http_major == 1 && req.http_minor == 0)) {
connection_close = true; connection_close = true;
} else { } else {
auto c = resp.fs.header(http2::HD_CONNECTION); auto c = resp.fs.header(http2::HD_CONNECTION);