http: rename CURLOPT_FILE to CURLOPT_WRITEDATA

The CURLOPT_FILE name is an alias for CURLOPT_WRITEDATA, the CURLOPT_WRITEDATA name has been preferred since curl 7.9.7, released in May 2002[1]. 1. https://curl.se/libcurl/c/CURLOPT_WRITEDATA.html Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jul 30, 2021 at 19:59 UTC 8dda4cbdf258be05e7201ef5d6e9d532cacb9178
4 files changed +9 -9
http-push.c
+3 -3
@@ -883,7 +883,7 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
883 slot->results = &results;
884 curl_setup_http(slot->curl, url, DAV_LOCK, &out_buffer, fwrite_buffer);
885 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
886 - curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
886 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &in_buffer);
887
888 CALLOC_ARRAY(lock, 1);
889 lock->timeout = -1;
@@ -1142,7 +1142,7 @@ static void remote_ls(const char *path, int flags,
1142 curl_setup_http(slot->curl, url, DAV_PROPFIND,
1143 &out_buffer, fwrite_buffer);
1144 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
1145 - curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
1145 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &in_buffer);
1146
1147 if (start_active_slot(slot)) {
1148 run_active_slot(slot);
@@ -1216,7 +1216,7 @@ static int locking_available(void)
1216 curl_setup_http(slot->curl, repo->url, DAV_PROPFIND,
1217 &out_buffer, fwrite_buffer);
1218 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
1219 - curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
1219 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &in_buffer);
1220
1221 if (start_active_slot(slot)) {
1222 run_active_slot(slot);
http-walker.c
+1 -1
@@ -378,7 +378,7 @@ static void fetch_alternates(struct walker *walker, const char *base)
378 alt_req.walker = walker;
379 slot->callback_data = &alt_req;
380
381 - curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
381 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buffer);
382 curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
383 curl_easy_setopt(slot->curl, CURLOPT_URL, url.buf);
384
http.c
+3 -3
@@ -1769,7 +1769,7 @@ static int http_request(const char *url,
1769 curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
1770 } else {
1771 curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
1772 - curl_easy_setopt(slot->curl, CURLOPT_FILE, result);
1772 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, result);
1773
1774 if (target == HTTP_REQUEST_FILE) {
1775 off_t posn = ftello(result);
@@ -2186,7 +2186,7 @@ struct http_pack_request *new_direct_http_pack_request(
2186 }
2187
2188 preq->slot = get_active_slot();
2189 - curl_easy_setopt(preq->slot->curl, CURLOPT_FILE, preq->packfile);
2189 + curl_easy_setopt(preq->slot->curl, CURLOPT_WRITEDATA, preq->packfile);
2190 curl_easy_setopt(preq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite);
2191 curl_easy_setopt(preq->slot->curl, CURLOPT_URL, preq->url);
2192 curl_easy_setopt(preq->slot->curl, CURLOPT_HTTPHEADER,
@@ -2357,7 +2357,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
2357
2358 freq->slot = get_active_slot();
2359
2360 - curl_easy_setopt(freq->slot->curl, CURLOPT_FILE, freq);
2360 + curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEDATA, freq);
2361 curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0);
2362 curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
2363 curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
remote-curl.c
+2 -2
@@ -853,7 +853,7 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
853 curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
854 curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
855 curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
856 - curl_easy_setopt(slot->curl, CURLOPT_FILE, &buf);
856 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buf);
857
858 err = run_slot(slot, results);
859
@@ -1016,7 +1016,7 @@ retry:
1016 rpc_in_data.slot = slot;
1017 rpc_in_data.check_pktline = stateless_connect;
1018 memset(&rpc_in_data.pktline_state, 0, sizeof(rpc_in_data.pktline_state));
1019 - curl_easy_setopt(slot->curl, CURLOPT_FILE, &rpc_in_data);
1019 + curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &rpc_in_data);
1020 curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
1021
1022