nghttpd: Set content-length in status response

This commit is contained in:
Tatsuhiro Tsujikawa 2016-05-14 17:29:29 +09:00
parent b011012d8f
commit 5c82a36072
1 changed files with 4 additions and 0 deletions

View File

@ -1121,8 +1121,12 @@ void prepare_status_response(Stream *stream, Http2Handler *hd, int status) {
data_prd.read_callback = file_read_callback; data_prd.read_callback = file_read_callback;
HeaderRefs headers; HeaderRefs headers;
headers.reserve(2);
headers.emplace_back(StringRef::from_lit("content-type"), headers.emplace_back(StringRef::from_lit("content-type"),
StringRef::from_lit("text/html; charset=UTF-8")); StringRef::from_lit("text/html; charset=UTF-8"));
headers.emplace_back(
StringRef::from_lit("content-length"),
util::make_string_ref_uint(stream->balloc, file_ent->length));
hd->submit_response(StringRef{status_page->status}, stream->stream_id, hd->submit_response(StringRef{status_page->status}, stream->stream_id,
headers, &data_prd); headers, &data_prd);
} }