nghttpx: Ignore trailer headers in HTTP/1.1

This commit is contained in:
Tatsuhiro Tsujikawa 2015-01-14 21:28:31 +09:00
parent 8fe093de1d
commit 1de20c1232
2 changed files with 16 additions and 0 deletions

View File

@ -532,6 +532,10 @@ int htp_hdrs_completecb(http_parser *htp) {
namespace {
int htp_hdr_keycb(http_parser *htp, const char *data, size_t len) {
auto downstream = static_cast<Downstream *>(htp->data);
if (downstream->get_response_state() != Downstream::INITIAL) {
// ignore trailers
return 0;
}
if (downstream->get_response_header_key_prev()) {
downstream->append_last_response_header_key(data, len);
} else {
@ -551,6 +555,10 @@ int htp_hdr_keycb(http_parser *htp, const char *data, size_t len) {
namespace {
int htp_hdr_valcb(http_parser *htp, const char *data, size_t len) {
auto downstream = static_cast<Downstream *>(htp->data);
if (downstream->get_response_state() != Downstream::INITIAL) {
// ignore trailers
return 0;
}
if (downstream->get_response_header_key_prev()) {
downstream->set_last_response_header_value(std::string(data, len));
} else {

View File

@ -82,6 +82,10 @@ namespace {
int htp_hdr_keycb(http_parser *htp, const char *data, size_t len) {
auto upstream = static_cast<HttpsUpstream *>(htp->data);
auto downstream = upstream->get_downstream();
if (downstream->get_request_state() != Downstream::INITIAL) {
// ignore trailers
return 0;
}
if (downstream->get_request_header_key_prev()) {
downstream->append_last_request_header_key(data, len);
} else {
@ -102,6 +106,10 @@ namespace {
int htp_hdr_valcb(http_parser *htp, const char *data, size_t len) {
auto upstream = static_cast<HttpsUpstream *>(htp->data);
auto downstream = upstream->get_downstream();
if (downstream->get_request_state() != Downstream::INITIAL) {
// ignore trailers
return 0;
}
if (downstream->get_request_header_key_prev()) {
downstream->set_last_request_header_value(std::string(data, len));
} else {