diff options
author | Jay Satiro <raysatiro@yahoo.com> | 2016-11-16 02:55:30 -0500 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2016-11-16 17:35:11 -0500 |
commit | a4d888857ede39a8e2aa5f961048c6362d3a5377 (patch) | |
tree | b40f5f1739b490b0e6a8695bd36c516027bfcc9d /lib | |
parent | 342aa4797edfabba78755e798d23a5b6d288d50b (diff) |
http2: Use huge HTTP/2 windows
- Improve performance by using a huge HTTP/2 window size.
Bug: https://github.com/curl/curl/issues/1102
Reported-by: afrind@users.noreply.github.com
Assisted-by: Tatsuhiro Tsujikawa
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http2.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/http2.c b/lib/http2.c index 6720984b0..202ab1b5d 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -59,6 +59,8 @@ #define nghttp2_session_callbacks_set_error_callback(x,y) #endif +#define HTTP2_HUGE_WINDOW_SIZE (1 << 30) + /* * Curl_http2_init_state() is called when the easy handle is created and * allows for HTTP/2 specific init of state. @@ -965,7 +967,7 @@ static ssize_t data_source_read_callback(nghttp2_session *session, */ static nghttp2_settings_entry settings[] = { { NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100 }, - { NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, NGHTTP2_INITIAL_WINDOW_SIZE }, + { NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, HTTP2_HUGE_WINDOW_SIZE }, }; #define H2_BUFSIZE 32768 @@ -2031,7 +2033,8 @@ CURLcode Curl_http2_switched(struct connectdata *conn, else { /* stream ID is unknown at this point */ stream->stream_id = -1; - rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE, NULL, 0); + rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE, settings, + sizeof(settings) / sizeof(settings[0])); if(rv != 0) { failf(data, "nghttp2_submit_settings() failed: %s(%d)", nghttp2_strerror(rv), rv); @@ -2039,6 +2042,14 @@ CURLcode Curl_http2_switched(struct connectdata *conn, } } + rv = nghttp2_session_set_local_window_size(httpc->h2, NGHTTP2_FLAG_NONE, 0, + HTTP2_HUGE_WINDOW_SIZE); + if(rv != 0) { + failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)", + nghttp2_strerror(rv), rv); + return CURLE_HTTP2; + } + /* we are going to copy mem to httpc->inbuf. This is required since mem is part of buffer pointed by stream->mem, and callbacks called by nghttp2_session_mem_recv() will write stream specific |