From: Stefan Eissing Date: Mon, 16 Nov 2015 11:42:14 +0000 (+0000) Subject: chaning WINDOW_SIZE default to protocol default, avoid sending the default value... X-Git-Tag: 2.5.0-alpha~2646 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3a771ed8606efbf30e7b70161d82bf93ac3eae3;p=thirdparty%2Fapache%2Fhttpd.git chaning WINDOW_SIZE default to protocol default, avoid sending the default value as SETTINGS git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1714560 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http2/h2_config.c b/modules/http2/h2_config.c index 1402de33bc5..7ac4297b328 100644 --- a/modules/http2/h2_config.c +++ b/modules/http2/h2_config.c @@ -29,6 +29,7 @@ #include "h2_ctx.h" #include "h2_conn.h" #include "h2_config.h" +#include "h2_h2.h" #include "h2_private.h" #define DEF_VAL (-1) @@ -38,22 +39,22 @@ static h2_config defconf = { "default", - 100, /* max_streams */ - 64 * 1024, /* window_size */ - -1, /* min workers */ - -1, /* max workers */ - 10 * 60, /* max workers idle secs */ - 64 * 1024, /* stream max mem size */ - NULL, /* no alt-svcs */ - -1, /* alt-svc max age */ - 0, /* serialize headers */ - -1, /* h2 direct mode */ - -1, /* # session extra files */ - 1, /* modern TLS only */ - -1, /* HTTP/1 Upgrade support */ - 1024*1024, /* TLS warmup size */ - 1, /* TLS cooldown secs */ - 1, /* HTTP/2 server push enabled */ + 100, /* max_streams */ + H2_INITIAL_WINDOW_SIZE, /* window_size */ + -1, /* min workers */ + -1, /* max workers */ + 10 * 60, /* max workers idle secs */ + 64 * 1024, /* stream max mem size */ + NULL, /* no alt-svcs */ + -1, /* alt-svc max age */ + 0, /* serialize headers */ + -1, /* h2 direct mode */ + -1, /* # session extra files */ + 1, /* modern TLS only */ + -1, /* HTTP/1 Upgrade support */ + 1024*1024, /* TLS warmup size */ + 1, /* TLS cooldown secs */ + 1, /* HTTP/2 server push enabled */ }; static int files_per_session = 0; diff --git a/modules/http2/h2_h2.h b/modules/http2/h2_h2.h index 7cf06ea940d..4974d866115 100644 --- a/modules/http2/h2_h2.h +++ b/modules/http2/h2_h2.h @@ -51,6 +51,8 @@ extern const char *H2_MAGIC_TOKEN; /* Maximum number of padding bytes in a frame, rfc7540 */ #define H2_MAX_PADLEN 256 +/* Initial default window size, RFC 7540 ch. 6.5.2 */ +#define H2_INITIAL_WINDOW_SIZE ((64*1024)-1) #define H2_HTTP_2XX(a) ((a) >= 200 && (a) < 300) diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index 89a2eb1ffee..1b1ddf365bf 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -828,6 +828,8 @@ apr_status_t h2_session_start(h2_session *session, int *rv) apr_status_t status = APR_SUCCESS; h2_config *config; nghttp2_settings_entry settings[3]; + size_t slen; + int i; AP_DEBUG_ASSERT(session); /* Start the conversation by submitting our SETTINGS frame */ @@ -890,16 +892,19 @@ apr_status_t h2_session_start(h2_session *session, int *rv) } } - settings[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; - settings[0].value = (uint32_t)session->max_stream_count; - settings[1].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; - settings[1].value = h2_config_geti(config, H2_CONF_WIN_SIZE); - settings[2].settings_id = NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE; - settings[2].value = 64*1024; + slen = 0; + settings[slen].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; + settings[slen].value = (uint32_t)session->max_stream_count; + ++slen; + i = h2_config_geti(config, H2_CONF_WIN_SIZE); + if (i != H2_INITIAL_WINDOW_SIZE) { + settings[slen].settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE; + settings[slen].value = i; + ++slen; + } *rv = nghttp2_submit_settings(session->ngh2, NGHTTP2_FLAG_NONE, - settings, - sizeof(settings)/sizeof(settings[0])); + settings, slen); if (*rv != 0) { status = APR_EGENERAL; ap_log_cerror(APLOG_MARK, APLOG_ERR, status, session->c,