diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 9dcd1157..5b7d8a28 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -609,7 +609,16 @@ typedef enum { /** * @macro - * Default maximum concurrent streams. + * + * Default maximum number of incoming concurrent streams. Use + * `nghttp2_submit_settings()` with + * :enum:`NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS` to change the + * maximum number of incoming concurrent streams. + * + * .. note:: + * + * The maximum number of outgoing concurrent streams is 100 by + * default. */ #define NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS ((1U << 31) - 1) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 938f27c9..191e2720 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -372,6 +372,9 @@ static int session_new(nghttp2_session **session_ptr, (*session_ptr)->max_incoming_reserved_streams = NGHTTP2_MAX_INCOMING_RESERVED_STREAMS; + /* Limit max outgoing concurrent streams to sensible value */ + (*session_ptr)->remote_settings.max_concurrent_streams = 100; + if (option) { if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE) && option->no_auto_window_update) { diff --git a/src/nghttp.cc b/src/nghttp.cc index 2a392f67..403f0fdd 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -95,8 +95,7 @@ constexpr auto anchors = std::array{{ Config::Config() : header_table_size(-1), min_header_table_size(std::numeric_limits::max()), padding(0), - max_concurrent_streams(100), - peer_max_concurrent_streams(NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS), + max_concurrent_streams(100), peer_max_concurrent_streams(100), weight(NGHTTP2_DEFAULT_WEIGHT), multiply(1), timeout(0.), window_bits(-1), connection_window_bits(-1), verbose(0), null_out(false), remote_name(false), get_assets(false), stat(false), upgrade(false),