nghttpx: Announce 2.0 in via header field

This commit is contained in:
Tatsuhiro Tsujikawa 2014-03-21 19:25:46 +09:00
parent ba5d9d3352
commit 334656b704
2 changed files with 7 additions and 4 deletions

View File

@ -880,10 +880,8 @@ int on_response_headers(Http2Session *http2session,
} }
downstream->set_response_http_status(strtoul(status->second.c_str(), downstream->set_response_http_status(strtoul(status->second.c_str(),
nullptr, 10)); nullptr, 10));
// Just assume it is HTTP/1.1. But we really consider to say 2.0 downstream->set_response_major(2);
// here. downstream->set_response_minor(0);
downstream->set_response_major(1);
downstream->set_response_minor(1);
auto content_length = http2::get_header(nva, "content-length"); auto content_length = http2::get_header(nva, "content-length");
if(!content_length && downstream->get_request_method() != "HEAD" && if(!content_length && downstream->get_request_method() != "HEAD" &&

View File

@ -229,6 +229,11 @@ int on_begin_headers_callback(nghttp2_session *session,
upstream->add_downstream(downstream); upstream->add_downstream(downstream);
downstream->init_response_body_buf(); downstream->init_response_body_buf();
// Although, we deprecated minor version from HTTP/2, we supply
// minor version 0 to use via header field in a conventional way.
downstream->set_request_major(2);
downstream->set_request_minor(0);
return 0; return 0;
} }
} // namespace } // namespace