]> granicus.if.org Git - curl/commitdiff
http2: always wait for readable socket
authorDaniel Stenberg <daniel@haxx.se>
Thu, 4 Aug 2016 22:42:52 +0000 (00:42 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 4 Aug 2016 22:44:01 +0000 (00:44 +0200)
Since the server can at any time send a HTTP/2 frame to us, we need to
wait for the socket to be readable during all transfers so that we can
act on incoming frames even when uploading etc.

Reminded-by: Tatsuhiro Tsujikawa
lib/http2.c

index 5bed6fcdf10de068035336f5a6dcc5e3e5cfbaf2..885208800589a59d7fd3aeec6310bb792ef29949 100644 (file)
@@ -92,8 +92,9 @@ static int http2_perform_getsock(const struct connectdata *conn,
      because of renegotiation. */
   sock[0] = conn->sock[FIRSTSOCKET];
 
-  if(nghttp2_session_want_read(c->h2))
-    bitmap |= GETSOCK_READSOCK(FIRSTSOCKET);
+  /* in a HTTP/2 connection we can basically always get a frame so we should
+     always be ready for one */
+  bitmap |= GETSOCK_READSOCK(FIRSTSOCKET);
 
   if(nghttp2_session_want_write(c->h2))
     bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET);