]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2: Fix missing nghttp2_session_send call in Curl_http2_switched
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>
Wed, 1 Apr 2015 15:28:58 +0000 (00:28 +0900)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 2 Apr 2015 13:19:29 +0000 (15:19 +0200)
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
lib/http2.c
tests/data/test1801

index 658d6141eaf895ba3b8b8597611a7a8126fae2ff..9410cf28299c6a220cf99678df53dddebfc3157f 100644 (file)
@@ -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;
 }
 
index a95e76a221d4b608462a64856bee706cf5c30d74..0aedfed51e12fb864525153c932c859bb9e07a6a 100644 (file)
@@ -23,7 +23,6 @@ lies!
 
 <datacheck>
 HTTP/1.1 101 Switching!
-
 </datacheck>
 
 # listen to the upgrade request!
@@ -62,9 +61,9 @@ Upgrade: %H2CVER
 HTTP2-Settings: AAMAAABkAAQAAP__\r
 \r
 </protocol>
-# nothing is returned, because no HTTP/2 data nor headers was handled
+# CURLE_HTTP2: Send failure: Broken pipe
 <errorcode>
-56
+16
 </errorcode>
 </verify>
 </testcase>