Commit e08df284 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Disallow 2nd message in http downstream

parent 1ce00f45
...@@ -389,6 +389,19 @@ bool HttpDownstreamConnection::get_output_buffer_full() ...@@ -389,6 +389,19 @@ bool HttpDownstreamConnection::get_output_buffer_full()
return evbuffer_get_length(output) >= OUTBUF_MAX_THRES; return evbuffer_get_length(output) >= OUTBUF_MAX_THRES;
} }
namespace {
int htp_msg_begincb(http_parser *htp)
{
auto downstream = static_cast<Downstream*>(htp->data);
if(downstream->get_response_state() != Downstream::INITIAL) {
return -1;
}
return 0;
}
} // namespace
namespace { namespace {
int htp_hdrs_completecb(http_parser *htp) int htp_hdrs_completecb(http_parser *htp)
{ {
...@@ -498,7 +511,7 @@ int htp_msg_completecb(http_parser *htp) ...@@ -498,7 +511,7 @@ int htp_msg_completecb(http_parser *htp)
namespace { namespace {
http_parser_settings htp_hooks = { http_parser_settings htp_hooks = {
nullptr, // http_cb on_message_begin; htp_msg_begincb, // http_cb on_message_begin;
nullptr, // http_data_cb on_url; nullptr, // http_data_cb on_url;
nullptr, // http_data_cb on_status; nullptr, // http_data_cb on_status;
htp_hdr_keycb, // http_data_cb on_header_field; htp_hdr_keycb, // http_data_cb on_header_field;
......
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