]> granicus.if.org Git - apache/commitdiff
chaning WINDOW_SIZE default to protocol default, avoid sending the default value...
authorStefan Eissing <icing@apache.org>
Mon, 16 Nov 2015 11:42:14 +0000 (11:42 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 16 Nov 2015 11:42:14 +0000 (11:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1714560 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_config.c
modules/http2/h2_h2.h
modules/http2/h2_session.c

index 1402de33bc5c0d2aaca15e4e63d38ca975f79f1c..7ac4297b32868649099a88d79ec7b6b8a6e22ab4 100644 (file)
@@ -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)
 
 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;
index 7cf06ea940d98a77b6063e490b5540974816a279..4974d86611550f3e1156fa9bb038a921d3c136f7 100644 (file)
@@ -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)
 
index 89a2eb1ffeebdca6680b6f027a3369f8c2684bca..1b1ddf365bfbe20c123e1a48c7a23d6aa95412c6 100644 (file)
@@ -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,