nghttpx: Include status code only in :status header field in HTTP2 response

This commit is contained in:
Tatsuhiro Tsujikawa 2013-08-25 23:28:34 +09:00
parent 5d7b7a1691
commit 4fb1811d18
1 changed files with 5 additions and 3 deletions

View File

@ -839,9 +839,9 @@ int Http2Upstream::error_reply(Downstream *downstream, int status_code)
data_prd.read_callback = spdy_data_read_callback; data_prd.read_callback = spdy_data_read_callback;
std::string content_length = util::utos(html.size()); std::string content_length = util::utos(html.size());
std::string status_code_str = std::to_string(status_code);
const char *nv[] = { const char *nv[] = {
":status", http::get_status_string(status_code), ":status", status_code_str.c_str(),
"content-type", "text/html; charset=UTF-8", "content-type", "text/html; charset=UTF-8",
"server", get_config()->server_name, "server", get_config()->server_name,
"content-length", content_length.c_str(), "content-length", content_length.c_str(),
@ -909,8 +909,10 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream)
const char **nv = new const char*[nheader * 2 + 4 + 1]; const char **nv = new const char*[nheader * 2 + 4 + 1];
size_t hdidx = 0; size_t hdidx = 0;
std::string via_value; std::string via_value;
std::string response_status =
std::to_string(downstream->get_response_http_status());
nv[hdidx++] = ":status"; nv[hdidx++] = ":status";
nv[hdidx++] = http::get_status_string(downstream->get_response_http_status()); nv[hdidx++] = response_status.c_str();
for(Headers::const_iterator i = downstream->get_response_headers().begin(); for(Headers::const_iterator i = downstream->get_response_headers().begin();
i != downstream->get_response_headers().end(); ++i) { i != downstream->get_response_headers().end(); ++i) {
if(util::strieq((*i).first.c_str(), "transfer-encoding") || if(util::strieq((*i).first.c_str(), "transfer-encoding") ||