Commit Graph

17 Commits

Author SHA1 Message Date
Junio C Hamano
f444e5286e Work around gcc warnings from curl headers
After master.k.org upgrade, I started seeing these warning messages:

    transport.c: In function 'get_refs_via_curl':
    transport.c:458: error: call to '_curl_easy_setopt_err_write_callback' declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option

It appears that the curl header wants to enforce the function signature
for callback function given to curl_easy_setopt() to be compatible with
that of (*curl_write_callback) or fwrite.  This patch seems to work the
issue around.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-04 00:37:40 -07:00
Daniel Barkalow
c13b2633f4 Make walker.fetch_ref() take a struct ref.
This simplifies a few things, makes a few things slightly more
complicated, but, more importantly, allows that, when struct ref can
represent a symref, http_fetch_ref() can return one.

Incidentally makes the string that http_fetch_ref() gets include "refs/"
(if appropriate), because that's how the name field of struct ref works.
As far as I can tell, the usage in walker:interpret_target() wouldn't have
worked previously, if it ever would have been used, which it wouldn't
(since the fetch process uses the hash instead of the name of the ref
there).

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-26 17:36:17 -07:00
Mike Hommey
9fc6440d78 Set proxy override with http_init()
In transport.c, proxy setting (the one from the remote conf) was set through
curl_easy_setopt() call, while http.c already does the same with the
http.proxy setting. We now just use this infrastructure instead, and make
http_init() now take the struct remote as argument so that it can take the
http_proxy setting from there, and any other property that would be added
later.

At the same time, we make get_http_walker() take a struct remote argument
too, and pass it to http_init(), which makes remote defined proxy be used
for more than get_refs_via_curl().

We leave out http-fetch and http-push, which don't use remotes for the
moment, purposefully.

Signed-off-by: Mike Hommey <mh@glandium.org>
Acked-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27 15:37:57 -08:00
Junio C Hamano
4f5f998fbd Clarify that http-push being temporarily disabled with older cURL
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-22 00:48:29 -08:00
Mike Hommey
d7e92806cd Move fetch_ref from http-push.c and http-walker.c to http.c
Make the necessary changes to be ok with their difference, and rename the
function http_fetch_ref.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey
028c297638 Use strbuf in http code
Also, replace whitespaces with tabs in some places

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey
e8dc37e0e3 Avoid redundant declaration of missing_target()
Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:31:59 -08:00
Mike Hommey
cc3530e8f3 Cleanup variables in http.[ch]
Quite some variables defined as extern in http.h are only used in http.c,
and some others, only defined in http.c, were not static.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 12:18:42 -08:00
Daniel Barkalow
fc57b6aaa5 Make function to refill http queue a callback
This eliminates the last function provided by the code using http.h as
a global symbol, so it should be possible to have multiple programs
using http.h in the same executable, and it also adds an argument to
that callback, so that info can be passed into the callback without
being global.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19 03:22:30 -07:00
Daniel Barkalow
45c1741235 Refactor http.h USE_CURL_MULTI fill_active_slots().
This removes all of the boilerplate and http-internal stuff from
fill_active_slots() and makes it easy to turn into a callback.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-19 03:22:29 -07:00
Alexandre Julliard
9cf04301b1 http-fetch: Disable use of curl multi support for libcurl < 7.16.
curl_multi_remove_handle() is broken in libcurl < 7.16, in that it
doesn't correctly update the active handles count when a request is
aborted. This causes the transfer to hang forever waiting for the
handle count to become less than the number of active requests.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-05-03 22:12:40 -07:00
Junio C Hamano
500ebb0196 Work around http-fetch built with cURL 7.16.0
It appears that curl_easy_duphandle() from libcurl 7.16.0
returns a curl session handle which fails GOOD_MULTI_HANDLE()
check in curl_multi_add_handle().  This causes fetch_ref() to
fail because start_active_slot() cannot start the request.

For now, check for 7.16.0 to work this issue around.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-27 16:44:30 -08:00
Art Haas
c774b2dcf6 Patch for http-fetch.c and older curl releases
Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they
use CURLE_HTTP_NOT_FOUND instead. Newer curl releases keep the
CURLE_HTTP_NOT_FOUND definition but using a -DCURL_NO_OLDIES
preprocessor flag the old name will not be present in the 'curl.h'
header.

This patch makes our code written for newer releases of the curl
library but allow compiling against an older curl (older than
0x070a03) by defining the missing CURLE_HTTP_RETURNED_ERROR as a
synonym for CURLE_HTTP_NOT_FOUND.

Signed-off-by: Art Haas <ahaas@airmail.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-09-20 07:53:43 -07:00
Nick Hengeveld
baa7b67d09 HTTP slot reuse fixes
Incorporate into http-push a fix related to accessing slot results after
the slot was reused, and fix a case in run_active_slot where a
finished slot wasn't detected if the slot was reused.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-03-10 23:01:48 -08:00
Mark Wooding
53f313897e http-fetch: Abort requests for objects which arrived in packs
In fetch_object, there's a call to release an object request if the
object mysteriously arrived, say in a pack.  Unfortunately, the fetch
attempt for this object might already be in progress, and we'll leak the
descriptor.  Instead, try to tidy away the request.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-02-07 02:13:02 -08:00
Nick Hengeveld
c8568e139e Fix HTTP request result processing after slot reuse
Add a way to store the results of an HTTP request when a slot finishes
so the results can be processed after the slot has been reused.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-31 16:17:24 -08:00
Nick Hengeveld
29508e1efb Isolate shared HTTP request functionality
Move shared HTTP request functionality out of http-fetch and http-push,
and replace the two fwrite_buffer/fwrite_buffer_dynamic functions with
one fwrite_buffer function that does dynamic buffering.  Use slot
callbacks to process responses to fetch object transfer requests and
push transfer requests, and put all of http-push into an #ifdef check
for curl multi support.

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-11-19 20:17:24 -08:00