http*: move common variables and macros to http.[ch]

Move RANGE_HEADER_SIZE to http.h.

Create no_pragma_header, the curl header list containing the header
"Pragma:" in http.[ch]. It is allocated in http_init, and freed in
http_cleanup. This replaces the no_pragma_header in http-push.c, and
the no_pragma_header member in walker_data in http-walker.c.

Create http_is_verbose. It is to be used by methods in http.c, and is
modified at the entry points of http.c's users, namely http-push.c
(when parsing options) and http-walker.c (in get_http_walker).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Tay Ray Chuan
2009-06-06 16:43:41 +08:00
committed by Junio C Hamano
parent df005219dd
commit e917674597
4 changed files with 20 additions and 20 deletions

9
http.c
View File

@ -2,6 +2,7 @@
int data_received;
int active_requests;
int http_is_verbose;
#ifdef USE_CURL_MULTI
static int max_requests = -1;
@ -29,6 +30,8 @@ static char *user_name, *user_pass;
static struct curl_slist *pragma_header;
struct curl_slist *no_pragma_header;
static struct active_request_slot *active_queue_head;
size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb, void *buffer_)
@ -276,6 +279,8 @@ void http_init(struct remote *remote)
char *low_speed_limit;
char *low_speed_time;
http_is_verbose = 0;
git_config(http_options, NULL);
curl_global_init(CURL_GLOBAL_ALL);
@ -284,6 +289,7 @@ void http_init(struct remote *remote)
curl_http_proxy = xstrdup(remote->http_proxy);
pragma_header = curl_slist_append(pragma_header, "Pragma: no-cache");
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
#ifdef USE_CURL_MULTI
{
@ -366,6 +372,9 @@ void http_cleanup(void)
curl_slist_free_all(pragma_header);
pragma_header = NULL;
curl_slist_free_all(no_pragma_header);
no_pragma_header = NULL;
if (curl_http_proxy) {
free((void *)curl_http_proxy);
curl_http_proxy = NULL;