Commit 1de20c12 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Ignore trailer headers in HTTP/1.1

parent 8fe093de
......@@ -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 {
......
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment