nghttpx: Take into account of trailers when applying max_header_fields
This commit is contained in:
parent
848f8fbe54
commit
2f50bc1b3c
|
@ -169,7 +169,8 @@ int on_header_callback(nghttp2_session *session, const nghttp2_frame *frame,
|
|||
|
||||
if (downstream->get_request_headers_sum() + namelen + valuelen >
|
||||
get_config()->header_field_buffer ||
|
||||
downstream->get_request_headers().size() >=
|
||||
downstream->get_request_headers().size() +
|
||||
downstream->get_request_trailers().size() >=
|
||||
get_config()->max_header_fields) {
|
||||
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
|
||||
return 0;
|
||||
|
|
|
@ -146,7 +146,8 @@ int htp_hdr_keycb(http_parser *htp, const char *data, size_t len) {
|
|||
if (downstream->get_request_trailer_key_prev()) {
|
||||
downstream->append_last_request_trailer_key(data, len);
|
||||
} else {
|
||||
if (downstream->get_request_headers().size() >=
|
||||
if (downstream->get_request_headers().size() +
|
||||
downstream->get_request_trailers().size() >=
|
||||
get_config()->max_header_fields) {
|
||||
if (LOG_ENABLED(INFO)) {
|
||||
ULOG(INFO, upstream) << "Too many header field num="
|
||||
|
|
|
@ -169,6 +169,8 @@ void on_ctrl_recv_callback(spdylay_session *session, spdylay_frame_type type,
|
|||
header_buffer += strlen(nv[i]) + strlen(nv[i + 1]);
|
||||
}
|
||||
|
||||
// spdy does not define usage of trailer fields, and we ignores
|
||||
// them.
|
||||
if (header_buffer > get_config()->header_field_buffer ||
|
||||
num_headers > get_config()->max_header_fields) {
|
||||
upstream->rst_stream(downstream, SPDYLAY_INTERNAL_ERROR);
|
||||
|
|
Loading…
Reference in New Issue