nghttpx: Apply timeout for incoming header block

This commit is contained in:
Tatsuhiro Tsujikawa 2016-10-09 17:18:43 +09:00
parent 175c7886ea
commit 2795da840c
2 changed files with 8 additions and 3 deletions

View File

@ -279,6 +279,8 @@ int on_begin_headers_callback(nghttp2_session *session,
downstream->reset_upstream_rtimer();
handler->repeat_read_timer();
auto &req = downstream->request();
// Although, we deprecated minor version from HTTP/2, we supply
@ -472,6 +474,7 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
verbose_on_frame_recv_callback(session, frame, user_data);
}
auto upstream = static_cast<Http2Upstream *>(user_data);
auto handler = upstream->get_client_handler();
switch (frame->hd.type) {
case NGHTTP2_DATA: {
@ -505,6 +508,8 @@ int on_frame_recv_callback(nghttp2_session *session, const nghttp2_frame *frame,
if (frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
downstream->reset_upstream_rtimer();
handler->stop_read_timer();
return upstream->on_request_headers(downstream, frame);
}
@ -1506,8 +1511,6 @@ int Http2Upstream::error_reply(Downstream *downstream,
void Http2Upstream::add_pending_downstream(
std::unique_ptr<Downstream> downstream) {
downstream_queue_.add_pending(std::move(downstream));
handler_->stop_read_timer();
}
void Http2Upstream::remove_downstream(Downstream *downstream) {

View File

@ -76,7 +76,7 @@ int htp_msg_begin(http_parser *htp) {
upstream->attach_downstream(std::move(downstream));
handler->stop_read_timer();
handler->repeat_read_timer();
return 0;
}
@ -292,6 +292,8 @@ int htp_hdrs_completecb(http_parser *htp) {
req.connection_close = !http_should_keep_alive(htp);
handler->stop_read_timer();
auto method = req.method;
if (LOG_ENABLED(INFO)) {