Skip to content

Commit 1e41827

Browse files
committed
http: clear POSTFIELDS when initializing a slot
After posting a short request using CURLOPT_POSTFIELDS, if the slot is reused for posting a large payload, the slot ends up having both POSTFIELDS (which now points at a random garbage) and READFUNCTION, in which case the curl library tries to use the stale POSTFIELDS. Clear it as part of the general slot initialization in get_active_slot(). Heavylifting-by: Shawn Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Acked-by: Shawn Pearce <[email protected]>
1 parent de1a2fd commit 1e41827

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

http.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ struct active_request_slot *get_active_slot(void)
494494
curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, NULL);
495495
curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, NULL);
496496
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
497+
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
497498
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
498499
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
499500

0 commit comments

Comments
 (0)