nghttpx: Disallow 2nd message in http downstream

This commit is contained in:
Tatsuhiro Tsujikawa 2014-07-03 20:57:07 +09:00
parent 1ce00f455c
commit e08df2840c
1 changed files with 14 additions and 1 deletions

View File

@ -389,6 +389,19 @@ bool HttpDownstreamConnection::get_output_buffer_full()
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 {
int htp_hdrs_completecb(http_parser *htp)
{
@ -498,7 +511,7 @@ int htp_msg_completecb(http_parser *htp)
namespace {
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_status;
htp_hdr_keycb, // http_data_cb on_header_field;