2005-11-18 19:02:58 +00:00
|
|
|
#ifndef HTTP_H
|
|
|
|
#define HTTP_H
|
|
|
|
|
|
|
|
#include "cache.h"
|
|
|
|
|
|
|
|
#include <curl/curl.h>
|
|
|
|
#include <curl/easy.h>
|
|
|
|
|
2007-12-09 19:30:59 +00:00
|
|
|
#include "strbuf.h"
|
2008-02-27 20:35:50 +00:00
|
|
|
#include "remote.h"
|
2010-11-25 08:21:04 +00:00
|
|
|
#include "url.h"
|
2007-12-09 19:30:59 +00:00
|
|
|
|
2008-01-22 01:34:43 +00:00
|
|
|
/*
|
|
|
|
* We detect based on the cURL version if multi-transfer is
|
|
|
|
* usable in this implementation and define this symbol accordingly.
|
2014-03-31 22:11:46 +00:00
|
|
|
* This shouldn't be set by the Makefile or by the user (e.g. via CFLAGS).
|
2008-01-22 01:34:43 +00:00
|
|
|
*/
|
|
|
|
#undef USE_CURL_MULTI
|
|
|
|
|
2007-05-02 12:53:23 +00:00
|
|
|
#if LIBCURL_VERSION_NUM >= 0x071000
|
2005-11-18 19:02:58 +00:00
|
|
|
#define USE_CURL_MULTI
|
|
|
|
#define DEFAULT_MAX_REQUESTS 5
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if LIBCURL_VERSION_NUM < 0x070704
|
2010-08-12 22:11:15 +00:00
|
|
|
#define curl_global_cleanup() do { /* nothing */ } while (0)
|
2005-11-18 19:02:58 +00:00
|
|
|
#endif
|
|
|
|
#if LIBCURL_VERSION_NUM < 0x070800
|
2010-08-12 22:11:15 +00:00
|
|
|
#define curl_global_init(a) do { /* nothing */ } while (0)
|
2005-11-18 19:02:58 +00:00
|
|
|
#endif
|
|
|
|
|
2006-12-27 21:59:26 +00:00
|
|
|
#if (LIBCURL_VERSION_NUM < 0x070c04) || (LIBCURL_VERSION_NUM == 0x071000)
|
2005-11-18 19:02:58 +00:00
|
|
|
#define NO_CURL_EASY_DUPHANDLE
|
|
|
|
#endif
|
|
|
|
|
2006-09-19 12:20:19 +00:00
|
|
|
#if LIBCURL_VERSION_NUM < 0x070a03
|
|
|
|
#define CURLE_HTTP_RETURNED_ERROR CURLE_HTTP_NOT_FOUND
|
|
|
|
#endif
|
|
|
|
|
2009-04-01 16:48:24 +00:00
|
|
|
#if LIBCURL_VERSION_NUM < 0x070c03
|
|
|
|
#define NO_CURL_IOCTL
|
|
|
|
#endif
|
|
|
|
|
2013-04-07 19:10:39 +00:00
|
|
|
/*
|
|
|
|
* CURLOPT_USE_SSL was known as CURLOPT_FTP_SSL up to 7.16.4,
|
|
|
|
* and the constants were known as CURLFTPSSL_*
|
|
|
|
*/
|
|
|
|
#if !defined(CURLOPT_USE_SSL) && defined(CURLOPT_FTP_SSL)
|
|
|
|
#define CURLOPT_USE_SSL CURLOPT_FTP_SSL
|
|
|
|
#define CURLUSESSL_TRY CURLFTPSSL_TRY
|
|
|
|
#endif
|
|
|
|
|
2011-03-16 07:08:34 +00:00
|
|
|
struct slot_results {
|
2006-01-31 19:06:55 +00:00
|
|
|
CURLcode curl_result;
|
|
|
|
long http_code;
|
2013-10-31 06:35:31 +00:00
|
|
|
long auth_avail;
|
2006-01-31 19:06:55 +00:00
|
|
|
};
|
|
|
|
|
2011-03-16 07:08:34 +00:00
|
|
|
struct active_request_slot {
|
2005-11-18 19:02:58 +00:00
|
|
|
CURL *curl;
|
|
|
|
int in_use;
|
|
|
|
CURLcode curl_result;
|
|
|
|
long http_code;
|
2006-03-11 04:18:01 +00:00
|
|
|
int *finished;
|
2006-01-31 19:06:55 +00:00
|
|
|
struct slot_results *results;
|
2005-11-18 19:02:58 +00:00
|
|
|
void *callback_data;
|
|
|
|
void (*callback_func)(void *data);
|
|
|
|
struct active_request_slot *next;
|
|
|
|
};
|
|
|
|
|
2011-03-16 07:08:34 +00:00
|
|
|
struct buffer {
|
2007-12-09 19:30:59 +00:00
|
|
|
struct strbuf buf;
|
|
|
|
size_t posn;
|
2005-11-18 19:02:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Curl request read/write callbacks */
|
2011-05-03 15:47:27 +00:00
|
|
|
extern size_t fread_buffer(char *ptr, size_t eltsize, size_t nmemb, void *strbuf);
|
|
|
|
extern size_t fwrite_buffer(char *ptr, size_t eltsize, size_t nmemb, void *strbuf);
|
|
|
|
extern size_t fwrite_null(char *ptr, size_t eltsize, size_t nmemb, void *strbuf);
|
2009-04-01 16:48:24 +00:00
|
|
|
#ifndef NO_CURL_IOCTL
|
|
|
|
extern curlioerr ioctl_buffer(CURL *handle, int cmd, void *clientp);
|
|
|
|
#endif
|
2005-11-18 19:02:58 +00:00
|
|
|
|
|
|
|
/* Slot lifecycle functions */
|
|
|
|
extern struct active_request_slot *get_active_slot(void);
|
|
|
|
extern int start_active_slot(struct active_request_slot *slot);
|
|
|
|
extern void run_active_slot(struct active_request_slot *slot);
|
2009-10-31 00:47:41 +00:00
|
|
|
extern void finish_active_slot(struct active_request_slot *slot);
|
2005-11-18 19:02:58 +00:00
|
|
|
extern void finish_all_active_slots(void);
|
http: do not set up curl auth after a 401
When we get an http 401, we prompt for credentials and put
them in our global credential struct. We also feed them to
the curl handle that produced the 401, with the intent that
they will be used on a retry.
When the code was originally introduced in commit 42653c0,
this was a necessary step. However, since dfa1725, we always
feed our global credential into every curl handle when we
initialize the slot with get_active_slot. So every further
request already feeds the credential to curl.
Moreover, accessing the slot here is somewhat dubious. After
the slot has produced a response, we don't actually control
it any more. If we are using curl_multi, it may even have
been re-initialized to handle a different request.
It just so happens that we will reuse the curl handle within
the slot in such a case, and that because we only keep one
global credential, it will be the one we want. So the
current code is not buggy, but it is misleading.
By cleaning it up, we can remove the slot argument entirely
from handle_curl_result, making it much more obvious that
slots should not be accessed after they are marked as
finished.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-10-12 07:35:59 +00:00
|
|
|
extern int handle_curl_result(struct slot_results *results);
|
2005-11-18 19:02:58 +00:00
|
|
|
|
|
|
|
#ifdef USE_CURL_MULTI
|
|
|
|
extern void fill_active_slots(void);
|
2007-09-11 03:02:34 +00:00
|
|
|
extern void add_fill_function(void *data, int (*fill)(void *));
|
2005-11-18 19:02:58 +00:00
|
|
|
extern void step_active_slots(void);
|
|
|
|
#endif
|
|
|
|
|
2011-12-14 00:11:56 +00:00
|
|
|
extern void http_init(struct remote *remote, const char *url,
|
|
|
|
int proactive_auth);
|
2005-11-18 19:02:58 +00:00
|
|
|
extern void http_cleanup(void);
|
|
|
|
|
|
|
|
extern int active_requests;
|
2009-06-06 08:43:41 +00:00
|
|
|
extern int http_is_verbose;
|
2009-10-31 00:47:41 +00:00
|
|
|
extern size_t http_post_buffer;
|
http: hoist credential request out of handle_curl_result
When we are handling a curl response code in http_request or
in the remote-curl RPC code, we use the handle_curl_result
helper to translate curl's response into an easy-to-use
code. When we see an HTTP 401, we do one of two things:
1. If we already had a filled-in credential, we mark it as
rejected, and then return HTTP_NOAUTH to indicate to
the caller that we failed.
2. If we didn't, then we ask for a new credential and tell
the caller HTTP_REAUTH to indicate that they may want
to try again.
Rejecting in the first case makes sense; it is the natural
result of the request we just made. However, prompting for
more credentials in the second step does not always make
sense. We do not know for sure that the caller is going to
make a second request, and nor are we sure that it will be
to the same URL. Logically, the prompt belongs not to the
request we just finished, but to the request we are (maybe)
about to make.
In practice, it is very hard to trigger any bad behavior.
Currently, if we make a second request, it will always be to
the same URL (even in the face of redirects, because curl
handles the redirects internally). And we almost always
retry on HTTP_REAUTH these days. The one exception is if we
are streaming a large RPC request to the server (e.g., a
pushed packfile), in which case we cannot restart. It's
extremely unlikely to see a 401 response at this stage,
though, as we would typically have seen it when we sent a
probe request, before streaming the data.
This patch drops the automatic prompt out of case 2, and
instead requires the caller to do it. This is a few extra
lines of code, and the bug it fixes is unlikely to come up
in practice. But it is conceptually cleaner, and paves the
way for better handling of credentials across redirects.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2013-09-28 08:31:45 +00:00
|
|
|
extern struct credential http_auth;
|
2005-11-18 19:02:58 +00:00
|
|
|
|
|
|
|
extern char curl_errorstr[CURL_ERROR_SIZE];
|
|
|
|
|
2007-12-10 21:36:09 +00:00
|
|
|
static inline int missing__target(int code, int result)
|
|
|
|
{
|
|
|
|
return /* file:// URL -- do we ever use one??? */
|
|
|
|
(result == CURLE_FILE_COULDNT_READ_FILE) ||
|
|
|
|
/* http:// and https:// URL */
|
|
|
|
(code == 404 && result == CURLE_HTTP_RETURNED_ERROR) ||
|
|
|
|
/* ftp:// URL */
|
|
|
|
(code == 550 && result == CURLE_FTP_COULDNT_RETR_FILE)
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define missing_target(a) missing__target((a)->http_code, (a)->curl_result)
|
|
|
|
|
http*: add helper methods for fetching objects (loose)
The code handling the fetching of loose objects in http-push.c and
http-walker.c have been refactored into new methods and a new struct
(object_http_request) in http.c. They are not meant to be invoked
elsewhere.
The new methods in http.c are
- new_http_object_request
- process_http_object_request
- finish_http_object_request
- abort_http_object_request
- release_http_object_request
and the new struct is http_object_request.
RANGER_HEADER_SIZE and no_pragma_header is no longer made available
outside of http.c, since after the above changes, there are no other
instances of usage outside of http.c.
Remove members of the transfer_request struct in http-push.c and
http-walker.c, including filename, real_sha1 and zret, as they are used
no longer used.
Move the methods append_remote_object_url() and get_remote_object_url()
from http-push.c to http.c. Additionally, get_remote_object_url() is no
longer defined only when USE_CURL_MULTI is defined, since
non-USE_CURL_MULTI code in http.c uses it (namely, in
new_http_object_request()).
Refactor code from http-push.c::start_fetch_loose() and
http-walker.c::start_object_fetch_request() that deals with the details
of coming up with the filename to store the retrieved object, resuming
a previously aborted request, and making a new curl request, into a new
function, new_http_object_request().
Refactor code from http-walker.c::process_object_request() into the
function, process_http_object_request().
Refactor code from http-push.c::finish_request() and
http-walker.c::finish_object_request() into a new function,
finish_http_object_request(). It returns the result of the
move_temp_to_file() invocation.
Add a function, release_http_object_request(), which cleans up object
request data. http-push.c and http-walker.c invoke this function
separately; http-push.c::release_request() and
http-walker.c::release_object_request() do not invoke this function.
Add a function, abort_http_object_request(), which unlink()s the object
file and invokes release_http_object_request(). Update
http-walker.c::abort_object_request() to use this.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 08:44:02 +00:00
|
|
|
/* Helpers for modifying and creating URLs */
|
|
|
|
extern void append_remote_object_url(struct strbuf *buf, const char *url,
|
|
|
|
const char *hex,
|
|
|
|
int only_two_digit_prefix);
|
|
|
|
extern char *get_remote_object_url(const char *url, const char *hex,
|
|
|
|
int only_two_digit_prefix);
|
|
|
|
|
2013-09-28 08:31:23 +00:00
|
|
|
/* Options for http_get_*() */
|
|
|
|
struct http_get_options {
|
|
|
|
unsigned no_cache:1,
|
|
|
|
keep_error:1;
|
2009-06-06 08:43:53 +00:00
|
|
|
|
2013-09-28 08:31:23 +00:00
|
|
|
/* If non-NULL, returns the content-type of the response. */
|
|
|
|
struct strbuf *content_type;
|
2013-09-28 08:32:02 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If non-NULL, returns the URL we ended up at, including any
|
|
|
|
* redirects we followed.
|
|
|
|
*/
|
|
|
|
struct strbuf *effective_url;
|
http: update base URLs when we see redirects
If a caller asks the http_get_* functions to go to a
particular URL and we end up elsewhere due to a redirect,
the effective_url field can tell us where we went.
It would be nice to remember this redirect and short-cut
further requests for two reasons:
1. It's more efficient. Otherwise we spend an extra http
round-trip to the server for each subsequent request,
just to get redirected.
2. If we end up with an http 401 and are going to ask for
credentials, it is to feed them to the redirect target.
If the redirect is an http->https upgrade, this means
our credentials may be provided on the http leg, just
to end up redirected to https. And if the redirect
crosses server boundaries, then curl will drop the
credentials entirely as it follows the redirect.
However, it, it is not enough to simply record the effective
URL we saw and use that for subsequent requests. We were
originally fed a "base" url like:
http://example.com/foo.git
and we want to figure out what the new base is, even though
the URLs we see may be:
original: http://example.com/foo.git/info/refs
effective: http://example.com/bar.git/info/refs
Subsequent requests will not be for "info/refs", but for
other paths relative to the base. We must ask the caller to
pass in the original base, and we must pass the redirected
base back to the caller (so that it can generate more URLs
from it). Furthermore, we need to feed the new base to the
credential code, so that requests to credential helpers (or
to the user) match the URL we will be requesting.
This patch teaches http_request_reauth to do this munging.
Since it is the caller who cares about making more URLs, it
seems at first glance that callers could simply check
effective_url themselves and handle it. However, since we
need to update the credential struct before the second
re-auth request, we have to do it inside http_request_reauth.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2013-09-28 08:34:05 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If both base_url and effective_url are non-NULL, the base URL will
|
|
|
|
* be munged to reflect any redirections going from the requested url
|
|
|
|
* to effective_url. See the definition of update_url_from_redirect
|
|
|
|
* for details.
|
|
|
|
*/
|
|
|
|
struct strbuf *base_url;
|
2013-09-28 08:31:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Return values for http_get_*() */
|
2009-06-06 08:43:53 +00:00
|
|
|
#define HTTP_OK 0
|
|
|
|
#define HTTP_MISSING_TARGET 1
|
|
|
|
#define HTTP_ERROR 2
|
|
|
|
#define HTTP_START_FAILED 3
|
2010-04-01 22:14:35 +00:00
|
|
|
#define HTTP_REAUTH 4
|
|
|
|
#define HTTP_NOAUTH 5
|
2009-06-06 08:43:53 +00:00
|
|
|
|
|
|
|
/*
|
2012-03-28 08:41:54 +00:00
|
|
|
* Requests a URL and stores the result in a strbuf.
|
2009-06-06 08:43:53 +00:00
|
|
|
*
|
|
|
|
* If the result pointer is NULL, a HTTP HEAD request is made instead of GET.
|
|
|
|
*/
|
2013-09-28 08:31:23 +00:00
|
|
|
int http_get_strbuf(const char *url, struct strbuf *result, struct http_get_options *options);
|
2009-06-06 08:43:53 +00:00
|
|
|
|
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 19:53:09 +00:00
|
|
|
extern int http_fetch_ref(const char *base, struct ref *ref);
|
2007-12-10 23:08:25 +00:00
|
|
|
|
2009-06-06 08:43:59 +00:00
|
|
|
/* Helpers for fetching packs */
|
|
|
|
extern int http_get_info_packs(const char *base_url,
|
|
|
|
struct packed_git **packs_head);
|
|
|
|
|
2011-03-16 07:08:34 +00:00
|
|
|
struct http_pack_request {
|
2009-06-06 08:44:01 +00:00
|
|
|
char *url;
|
|
|
|
struct packed_git *target;
|
|
|
|
struct packed_git **lst;
|
|
|
|
FILE *packfile;
|
|
|
|
char tmpfile[PATH_MAX];
|
|
|
|
struct curl_slist *range_header;
|
|
|
|
struct active_request_slot *slot;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct http_pack_request *new_http_pack_request(
|
|
|
|
struct packed_git *target, const char *base_url);
|
|
|
|
extern int finish_http_pack_request(struct http_pack_request *preq);
|
|
|
|
extern void release_http_pack_request(struct http_pack_request *preq);
|
|
|
|
|
http*: add helper methods for fetching objects (loose)
The code handling the fetching of loose objects in http-push.c and
http-walker.c have been refactored into new methods and a new struct
(object_http_request) in http.c. They are not meant to be invoked
elsewhere.
The new methods in http.c are
- new_http_object_request
- process_http_object_request
- finish_http_object_request
- abort_http_object_request
- release_http_object_request
and the new struct is http_object_request.
RANGER_HEADER_SIZE and no_pragma_header is no longer made available
outside of http.c, since after the above changes, there are no other
instances of usage outside of http.c.
Remove members of the transfer_request struct in http-push.c and
http-walker.c, including filename, real_sha1 and zret, as they are used
no longer used.
Move the methods append_remote_object_url() and get_remote_object_url()
from http-push.c to http.c. Additionally, get_remote_object_url() is no
longer defined only when USE_CURL_MULTI is defined, since
non-USE_CURL_MULTI code in http.c uses it (namely, in
new_http_object_request()).
Refactor code from http-push.c::start_fetch_loose() and
http-walker.c::start_object_fetch_request() that deals with the details
of coming up with the filename to store the retrieved object, resuming
a previously aborted request, and making a new curl request, into a new
function, new_http_object_request().
Refactor code from http-walker.c::process_object_request() into the
function, process_http_object_request().
Refactor code from http-push.c::finish_request() and
http-walker.c::finish_object_request() into a new function,
finish_http_object_request(). It returns the result of the
move_temp_to_file() invocation.
Add a function, release_http_object_request(), which cleans up object
request data. http-push.c and http-walker.c invoke this function
separately; http-push.c::release_request() and
http-walker.c::release_object_request() do not invoke this function.
Add a function, abort_http_object_request(), which unlink()s the object
file and invokes release_http_object_request(). Update
http-walker.c::abort_object_request() to use this.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 08:44:02 +00:00
|
|
|
/* Helpers for fetching object */
|
2011-03-16 07:08:34 +00:00
|
|
|
struct http_object_request {
|
http*: add helper methods for fetching objects (loose)
The code handling the fetching of loose objects in http-push.c and
http-walker.c have been refactored into new methods and a new struct
(object_http_request) in http.c. They are not meant to be invoked
elsewhere.
The new methods in http.c are
- new_http_object_request
- process_http_object_request
- finish_http_object_request
- abort_http_object_request
- release_http_object_request
and the new struct is http_object_request.
RANGER_HEADER_SIZE and no_pragma_header is no longer made available
outside of http.c, since after the above changes, there are no other
instances of usage outside of http.c.
Remove members of the transfer_request struct in http-push.c and
http-walker.c, including filename, real_sha1 and zret, as they are used
no longer used.
Move the methods append_remote_object_url() and get_remote_object_url()
from http-push.c to http.c. Additionally, get_remote_object_url() is no
longer defined only when USE_CURL_MULTI is defined, since
non-USE_CURL_MULTI code in http.c uses it (namely, in
new_http_object_request()).
Refactor code from http-push.c::start_fetch_loose() and
http-walker.c::start_object_fetch_request() that deals with the details
of coming up with the filename to store the retrieved object, resuming
a previously aborted request, and making a new curl request, into a new
function, new_http_object_request().
Refactor code from http-walker.c::process_object_request() into the
function, process_http_object_request().
Refactor code from http-push.c::finish_request() and
http-walker.c::finish_object_request() into a new function,
finish_http_object_request(). It returns the result of the
move_temp_to_file() invocation.
Add a function, release_http_object_request(), which cleans up object
request data. http-push.c and http-walker.c invoke this function
separately; http-push.c::release_request() and
http-walker.c::release_object_request() do not invoke this function.
Add a function, abort_http_object_request(), which unlink()s the object
file and invokes release_http_object_request(). Update
http-walker.c::abort_object_request() to use this.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 08:44:02 +00:00
|
|
|
char *url;
|
|
|
|
char tmpfile[PATH_MAX];
|
|
|
|
int localfile;
|
|
|
|
CURLcode curl_result;
|
|
|
|
char errorstr[CURL_ERROR_SIZE];
|
|
|
|
long http_code;
|
|
|
|
unsigned char sha1[20];
|
|
|
|
unsigned char real_sha1[20];
|
|
|
|
git_SHA_CTX c;
|
2011-06-10 18:52:15 +00:00
|
|
|
git_zstream stream;
|
http*: add helper methods for fetching objects (loose)
The code handling the fetching of loose objects in http-push.c and
http-walker.c have been refactored into new methods and a new struct
(object_http_request) in http.c. They are not meant to be invoked
elsewhere.
The new methods in http.c are
- new_http_object_request
- process_http_object_request
- finish_http_object_request
- abort_http_object_request
- release_http_object_request
and the new struct is http_object_request.
RANGER_HEADER_SIZE and no_pragma_header is no longer made available
outside of http.c, since after the above changes, there are no other
instances of usage outside of http.c.
Remove members of the transfer_request struct in http-push.c and
http-walker.c, including filename, real_sha1 and zret, as they are used
no longer used.
Move the methods append_remote_object_url() and get_remote_object_url()
from http-push.c to http.c. Additionally, get_remote_object_url() is no
longer defined only when USE_CURL_MULTI is defined, since
non-USE_CURL_MULTI code in http.c uses it (namely, in
new_http_object_request()).
Refactor code from http-push.c::start_fetch_loose() and
http-walker.c::start_object_fetch_request() that deals with the details
of coming up with the filename to store the retrieved object, resuming
a previously aborted request, and making a new curl request, into a new
function, new_http_object_request().
Refactor code from http-walker.c::process_object_request() into the
function, process_http_object_request().
Refactor code from http-push.c::finish_request() and
http-walker.c::finish_object_request() into a new function,
finish_http_object_request(). It returns the result of the
move_temp_to_file() invocation.
Add a function, release_http_object_request(), which cleans up object
request data. http-push.c and http-walker.c invoke this function
separately; http-push.c::release_request() and
http-walker.c::release_object_request() do not invoke this function.
Add a function, abort_http_object_request(), which unlink()s the object
file and invokes release_http_object_request(). Update
http-walker.c::abort_object_request() to use this.
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 08:44:02 +00:00
|
|
|
int zret;
|
|
|
|
int rename;
|
|
|
|
struct active_request_slot *slot;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern struct http_object_request *new_http_object_request(
|
|
|
|
const char *base_url, unsigned char *sha1);
|
|
|
|
extern void process_http_object_request(struct http_object_request *freq);
|
|
|
|
extern int finish_http_object_request(struct http_object_request *freq);
|
|
|
|
extern void abort_http_object_request(struct http_object_request *freq);
|
|
|
|
extern void release_http_object_request(struct http_object_request *freq);
|
|
|
|
|
2005-11-18 19:02:58 +00:00
|
|
|
#endif /* HTTP_H */
|