]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
transfer: break the read loop when RECV is cleared
authorDaniel Stenberg <daniel@haxx.se>
Wed, 28 Dec 2022 10:08:44 +0000 (11:08 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 30 Dec 2022 08:20:55 +0000 (09:20 +0100)
When the RECV bit is cleared because the response reading for this
transfer is complete, the read loop should be stopped. data_pending()
can otherwise still return TRUE and another read would be attempted.

Reported-by: Hide Ishikawa
Fixes #10172
Closes #10174

lib/transfer.c

index e58619a84c3d5abb892c445d0129e2d53f963880..58bb8be4cfe48bf7cbb8ce2f624803fa2a984d21 100644 (file)
@@ -776,8 +776,8 @@ static CURLcode readwrite_data(struct Curl_easy *data,
       k->keepon &= ~KEEP_RECV;
     }
 
-    if(k->keepon & KEEP_RECV_PAUSE) {
-      /* this is a paused transfer */
+    if((k->keepon & KEEP_RECV_PAUSE) || !(k->keepon & KEEP_RECV)) {
+      /* this is a paused or stopped transfer */
       break;
     }