]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2: getsock fix for uploads
authorDaniel Stenberg <daniel@haxx.se>
Sat, 12 May 2018 19:58:46 +0000 (21:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 14 May 2018 06:22:46 +0000 (08:22 +0200)
When there's an upload in progress, make sure to wait for the socket to
become writable.

Detected-by: steini2000 on github
Bug: #2520
Closes #2567

lib/http2.c

index 770ebdab5e81b5e961fd6ec57ecb2d880db96f9b..62b1092934de7db08441c6e05a04ff919df8ac1f 100644 (file)
@@ -108,6 +108,7 @@ static int http2_perform_getsock(const struct connectdata *conn,
                                  int numsocks)
 {
   const struct http_conn *c = &conn->proto.httpc;
+  struct SingleRequest *k = &conn->data->req;
   int bitmap = GETSOCK_BLANK;
   (void)numsocks;
 
@@ -119,7 +120,9 @@ static int http2_perform_getsock(const struct connectdata *conn,
      always be ready for one */
   bitmap |= GETSOCK_READSOCK(FIRSTSOCKET);
 
-  if(nghttp2_session_want_write(c->h2))
+  /* we're still uploading or the HTTP/2 layer wants to send data */
+  if(((k->keepon & (KEEP_SEND|KEEP_SEND_PAUSE)) == KEEP_SEND) ||
+     nghttp2_session_want_write(c->h2))
     bitmap |= GETSOCK_WRITESOCK(FIRSTSOCKET);
 
   return bitmap;