From: Tatsuhiro Tsujikawa Date: Wed, 1 Apr 2015 15:28:58 +0000 (+0900) Subject: http2: Fix missing nghttp2_session_send call in Curl_http2_switched X-Git-Tag: curl-7_42_0~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21e82bd635124881a4a2ac08b3b9b28efe98afee;p=thirdparty%2Fcurl.git http2: Fix missing nghttp2_session_send call in Curl_http2_switched Previously in Curl_http2_switched, we called nghttp2_session_mem_recv to parse incoming data which were already received while curl was handling upgrade. But we didn't call nghttp2_session_send, and it led to make curl not send any response to the received frames. Most likely, we received SETTINGS from server at this point, so we missed opportunity to send SETTINGS + ACK. This commit adds missing nghttp2_session_send call in Curl_http2_switched to fix this issue. Bug: https://github.com/bagder/curl/issues/192 Reported-by: Stefan Eissing --- diff --git a/lib/http2.c b/lib/http2.c index 658d6141ea..9410cf2829 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -1062,6 +1062,15 @@ CURLcode Curl_http2_switched(struct connectdata *conn, return CURLE_HTTP2; } + /* Try to send some frames since we may read SETTINGS already. */ + rv = nghttp2_session_send(httpc->h2); + + if(rv != 0) { + failf(data, "nghttp2_session_send() failed: %s(%d)", + nghttp2_strerror(rv), rv); + return CURLE_HTTP2; + } + return CURLE_OK; } diff --git a/tests/data/test1801 b/tests/data/test1801 index a95e76a221..0aedfed51e 100644 --- a/tests/data/test1801 +++ b/tests/data/test1801 @@ -23,7 +23,6 @@ lies! HTTP/1.1 101 Switching! - # listen to the upgrade request! @@ -62,9 +61,9 @@ Upgrade: %H2CVER HTTP2-Settings: AAMAAABkAAQAAP__ -# nothing is returned, because no HTTP/2 data nor headers was handled +# CURLE_HTTP2: Send failure: Broken pipe -56 +16