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 <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Shawn Pearce <spearce@spearce.org>
Junio C Hamano committed
Apr 26, 2011 at 08:04 UTC
1e41827d2d5cf0e4c6ebff91958fa47d69b7ff42
1 file changed
+1
http.c
+1
@@ -494,6 +494,7 @@ struct active_request_slot *get_active_slot(void)
494
curl_easy_setopt(slot->curl, CURLOPT_CUSTOMREQUEST, NULL);
495
curl_easy_setopt(slot->curl, CURLOPT_READFUNCTION, NULL);
496
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
497
+ curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
498
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
499
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
500