Skip to content

Commit

Permalink
Merge branch 'ab/http-drop-old-curl'
Browse files Browse the repository at this point in the history
Support for ancient versions of cURL library (pre 7.19.4) has been
dropped.

* ab/http-drop-old-curl:
  http: rename CURLOPT_FILE to CURLOPT_WRITEDATA
  http: drop support for curl < 7.19.3 and < 7.17.0 (again)
  http: drop support for curl < 7.19.4
  http: drop support for curl < 7.16.0
  http: drop support for curl < 7.11.1
  • Loading branch information
gitster committed Aug 24, 2021
2 parents 2f71366 + 8dda4cb commit e48a623
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 263 deletions.
29 changes: 3 additions & 26 deletions http-push.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,8 @@ static void curl_setup_http(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_INFILE, buffer);
curl_easy_setopt(curl, CURLOPT_INFILESIZE, buffer->buf.len);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
#ifndef NO_CURL_IOCTL
curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, ioctl_buffer);
curl_easy_setopt(curl, CURLOPT_IOCTLDATA, buffer);
#endif
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn);
curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
Expand Down Expand Up @@ -249,8 +247,6 @@ static void process_response(void *callback_data)
finish_request(request);
}

#ifdef USE_CURL_MULTI

static void start_fetch_loose(struct transfer_request *request)
{
struct active_request_slot *slot;
Expand Down Expand Up @@ -299,7 +295,6 @@ static void start_mkcol(struct transfer_request *request)
FREE_AND_NULL(request->url);
}
}
#endif

static void start_fetch_packed(struct transfer_request *request)
{
Expand Down Expand Up @@ -605,7 +600,6 @@ static void finish_request(struct transfer_request *request)
}
}

#ifdef USE_CURL_MULTI
static int is_running_queue;
static int fill_active_slot(void *unused)
{
Expand All @@ -629,7 +623,6 @@ static int fill_active_slot(void *unused)
}
return 0;
}
#endif

static void get_remote_object_list(unsigned char parent);

Expand Down Expand Up @@ -658,10 +651,8 @@ static void add_fetch_request(struct object *obj)
request->next = request_queue_head;
request_queue_head = request;

#ifdef USE_CURL_MULTI
fill_active_slots();
step_active_slots();
#endif
}

static int add_send_request(struct object *obj, struct remote_lock *lock)
Expand Down Expand Up @@ -696,10 +687,8 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
request->next = request_queue_head;
request_queue_head = request;

#ifdef USE_CURL_MULTI
fill_active_slots();
step_active_slots();
#endif

return 1;
}
Expand Down Expand Up @@ -894,7 +883,7 @@ static struct remote_lock *lock_remote(const char *path, long timeout)
slot->results = &results;
curl_setup_http(slot->curl, url, DAV_LOCK, &out_buffer, fwrite_buffer);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &in_buffer);

CALLOC_ARRAY(lock, 1);
lock->timeout = -1;
Expand Down Expand Up @@ -1153,7 +1142,7 @@ static void remote_ls(const char *path, int flags,
curl_setup_http(slot->curl, url, DAV_PROPFIND,
&out_buffer, fwrite_buffer);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &in_buffer);

if (start_active_slot(slot)) {
run_active_slot(slot);
Expand Down Expand Up @@ -1227,7 +1216,7 @@ static int locking_available(void)
curl_setup_http(slot->curl, repo->url, DAV_PROPFIND,
&out_buffer, fwrite_buffer);
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, dav_headers);
curl_easy_setopt(slot->curl, CURLOPT_FILE, &in_buffer);
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &in_buffer);

if (start_active_slot(slot)) {
run_active_slot(slot);
Expand Down Expand Up @@ -1682,21 +1671,15 @@ static int delete_remote_branch(const char *pattern, int force)

static void run_request_queue(void)
{
#ifdef USE_CURL_MULTI
is_running_queue = 1;
fill_active_slots();
add_fill_function(NULL, fill_active_slot);
#endif
do {
finish_all_active_slots();
#ifdef USE_CURL_MULTI
fill_active_slots();
#endif
} while (request_queue_head && !aborted);

#ifdef USE_CURL_MULTI
is_running_queue = 0;
#endif
}

int cmd_main(int argc, const char **argv)
Expand Down Expand Up @@ -1770,10 +1753,6 @@ int cmd_main(int argc, const char **argv)
break;
}

#ifndef USE_CURL_MULTI
die("git-push is not available for http/https repository when not compiled with USE_CURL_MULTI");
#endif

if (!repo->url)
usage(http_push_usage);

Expand All @@ -1786,9 +1765,7 @@ int cmd_main(int argc, const char **argv)

http_init(NULL, repo->url, 1);

#ifdef USE_CURL_MULTI
is_running_queue = 0;
#endif

/* Verify DAV compliance/lock support */
if (!locking_available()) {
Expand Down
14 changes: 1 addition & 13 deletions http-walker.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ static void release_object_request(struct object_request *obj_req)
free(obj_req);
}

#ifdef USE_CURL_MULTI
static int fill_active_slot(struct walker *walker)
{
struct object_request *obj_req;
Expand All @@ -146,7 +145,6 @@ static int fill_active_slot(struct walker *walker)
}
return 0;
}
#endif

static void prefetch(struct walker *walker, unsigned char *sha1)
{
Expand All @@ -163,10 +161,8 @@ static void prefetch(struct walker *walker, unsigned char *sha1)
http_is_verbose = walker->get_verbosely;
list_add_tail(&newreq->node, &object_queue_head);

#ifdef USE_CURL_MULTI
fill_active_slots();
step_active_slots();
#endif
}

static int is_alternate_allowed(const char *url)
Expand Down Expand Up @@ -357,11 +353,9 @@ static void fetch_alternates(struct walker *walker, const char *base)
* wait for them to arrive and return to processing this request's
* curl message
*/
#ifdef USE_CURL_MULTI
while (cdata->got_alternates == 0) {
step_active_slots();
}
#endif

/* Nothing to do if they've already been fetched */
if (cdata->got_alternates == 1)
Expand All @@ -384,7 +378,7 @@ static void fetch_alternates(struct walker *walker, const char *base)
alt_req.walker = walker;
slot->callback_data = &alt_req;

curl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buffer);
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
curl_easy_setopt(slot->curl, CURLOPT_URL, url.buf);

Expand Down Expand Up @@ -505,12 +499,8 @@ static int fetch_object(struct walker *walker, unsigned char *hash)
return 0;
}

#ifdef USE_CURL_MULTI
while (obj_req->state == WAITING)
step_active_slots();
#else
start_object_request(walker, obj_req);
#endif

/*
* obj_req->req might change when fetching alternates in the callback
Expand Down Expand Up @@ -623,9 +613,7 @@ struct walker *get_http_walker(const char *url)
walker->cleanup = cleanup;
walker->data = data;

#ifdef USE_CURL_MULTI
add_fill_function(walker, (int (*)(void *)) fill_active_slot);
#endif

return walker;
}

0 comments on commit e48a623

Please sign in to comment.