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

View File

@ -27,7 +27,6 @@ enum XML_Status {
#endif
#define PREV_BUF_SIZE 4096
#define RANGE_HEADER_SIZE 30
/* DAV methods */
#define DAV_LOCK "LOCK"
@ -76,8 +75,6 @@ static int pushing;
static int aborted;
static signed char remote_dir_exists[256];
static struct curl_slist *no_pragma_header;
static int push_verbosely;
static int push_all = MATCH_REFS_NONE;
static int force_all;
@ -2250,6 +2247,7 @@ int main(int argc, char **argv)
}
if (!strcmp(arg, "--verbose")) {
push_verbosely = 1;
http_is_verbose = 1;
continue;
}
if (!strcmp(arg, "-d")) {
@ -2299,8 +2297,6 @@ int main(int argc, char **argv)
remote->url[remote->url_nr++] = repo->url;
http_init(remote);
no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:");
if (repo->url && repo->url[strlen(repo->url)-1] != '/') {
rewritten_url = xmalloc(strlen(repo->url)+2);
strcpy(rewritten_url, repo->url);
@ -2503,8 +2499,6 @@ int main(int argc, char **argv)
unlock_remote(info_ref_lock);
free(repo);
curl_slist_free_all(no_pragma_header);
http_cleanup();
request = request_queue_head;