Commit 303f0f3f authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Return 413 if request header is too large

For now, if request has request body, we'll issue RST_STREAM to inform
the peer to stop sending body.  RST_STREAM may be sent before error
page header or data, so peer may receive RST_STREAM only.
parent ca87b45f
......@@ -212,12 +212,21 @@ int on_header_callback(nghttp2_session *session,
return 0;
}
if(downstream->get_request_headers_sum() > Downstream::MAX_HEADERS_SUM) {
if(downstream->get_response_state() == Downstream::MSG_COMPLETE) {
return 0;
}
if(LOG_ENABLED(INFO)) {
ULOG(INFO, upstream) << "Too large header block size="
<< downstream->get_request_headers_sum();
}
if(upstream->error_reply(downstream, 413) != 0) {
return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
}
return 0;
}
if(!http2::check_nv(name, namelen, value, valuelen)) {
return 0;
}
......@@ -267,6 +276,10 @@ int on_request_headers(Http2Upstream *upstream,
{
int rv;
if(downstream->get_response_state() == Downstream::MSG_COMPLETE) {
return 0;
}
downstream->normalize_request_headers();
auto& nva = downstream->get_request_headers();
......
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