diff --git a/src/HttpServer.cc b/src/HttpServer.cc index e5406cdc..15650136 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -577,6 +577,10 @@ Http2Handler::WriteBuf *Http2Handler::get_wb() { return &wb_; } int Http2Handler::setup_bev() { return 0; } +void Http2Handler::start_settings_timer() { + ev_timer_start(sessions_->get_loop(), &settings_timerev_); +} + int Http2Handler::fill_wb() { if (data_pending_) { auto n = std::min(wb_.wleft(), data_pendinglen_); @@ -870,8 +874,6 @@ int Http2Handler::connection_made() { } } - ev_timer_start(sessions_->get_loop(), &settings_timerev_); - if (ssl_ && !nghttp2::ssl::check_http2_requirement(ssl_)) { terminate_session(NGHTTP2_INADEQUATE_SECURITY); } @@ -1538,6 +1540,15 @@ int hd_on_frame_send_callback(nghttp2_session *session, break; } + case NGHTTP2_SETTINGS: { + if (frame->hd.flags & NGHTTP2_FLAG_ACK) { + return 0; + } + + hd->start_settings_timer(); + + break; + } case NGHTTP2_PUSH_PROMISE: { auto promised_stream_id = frame->push_promise.promised_stream_id; auto promised_stream = hd->get_stream(promised_stream_id); diff --git a/src/HttpServer.h b/src/HttpServer.h index 99623397..27b5b2c9 100644 --- a/src/HttpServer.h +++ b/src/HttpServer.h @@ -138,6 +138,7 @@ public: void remove_self(); int setup_bev(); + void start_settings_timer(); int on_read(); int on_write(); int connection_made();