nghttpx: Fix bug that 204 from h1 backend is always treated as error

This commit is contained in:
Tatsuhiro Tsujikawa 2017-04-07 21:45:13 +09:00
parent 3a1217e667
commit 46ccc4332c
1 changed files with 2 additions and 3 deletions

View File

@ -892,13 +892,12 @@ int htp_hdrs_completecb(http_parser *htp) {
if (resp.fs.parse_content_length() != 0) { if (resp.fs.parse_content_length() != 0) {
return -1; return -1;
} }
if (resp.fs.content_length != 0) {
return -1;
}
if (resp.fs.content_length == 0) { if (resp.fs.content_length == 0) {
auto cl = resp.fs.header(http2::HD_CONTENT_LENGTH); auto cl = resp.fs.header(http2::HD_CONTENT_LENGTH);
assert(cl); assert(cl);
http2::erase_header(cl); http2::erase_header(cl);
} else if (resp.fs.content_length != -1) {
return -1;
} }
} else if (resp.http_status / 100 == 1 || } else if (resp.http_status / 100 == 1 ||
(resp.http_status == 200 && req.method == HTTP_CONNECT)) { (resp.http_status == 200 && req.method == HTTP_CONNECT)) {