From: Junio C Hamano Date: Sat, 8 Mar 2008 10:20:37 +0000 (-0800) Subject: Merge branch 'mh/maint-http-proxy-fix' into maint X-Git-Tag: v1.5.4.4~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/972b9a85301e1576c0fb84555396015663a65452?ds=inline;hp=-c Merge branch 'mh/maint-http-proxy-fix' into maint * mh/maint-http-proxy-fix: Set proxy override with http_init() --- 972b9a85301e1576c0fb84555396015663a65452 diff --combined http-push.c index f9b77d6021,869c01c75b..e3e34decd2 --- a/http-push.c +++ b/http-push.c @@@ -1634,19 -1634,12 +1634,19 @@@ static struct object_list **process_tre init_tree_desc(&desc, tree->buffer, tree->size); - while (tree_entry(&desc, &entry)) { - if (S_ISDIR(entry.mode)) + while (tree_entry(&desc, &entry)) + switch (object_type(entry.mode)) { + case OBJ_TREE: p = process_tree(lookup_tree(entry.sha1), p, &me, name); - else + break; + case OBJ_BLOB: p = process_blob(lookup_blob(entry.sha1), p, &me, name); - } + break; + default: + /* Subproject commit - not in this repository */ + break; + } + free(tree->buffer); tree->buffer = NULL; return p; @@@ -2240,7 -2233,7 +2240,7 @@@ int main(int argc, char **argv memset(remote_dir_exists, -1, 256); - http_init(); + http_init(NULL); no_pragma_header = curl_slist_append(no_pragma_header, "Pragma:"); @@@ -2405,17 -2398,15 +2405,17 @@@ fill_active_slots(); add_fill_function(NULL, fill_active_slot); #endif - finish_all_active_slots(); + do { + finish_all_active_slots(); +#ifdef USE_CURL_MULTI + fill_active_slots(); +#endif + } while (request_queue_head && !aborted); /* Update the remote branch if all went well */ - if (aborted || !update_remote(ref->new_sha1, ref_lock)) { + if (aborted || !update_remote(ref->new_sha1, ref_lock)) rc = 1; - goto unlock; - } - unlock: if (!rc) fprintf(stderr, " done\n"); unlock_remote(ref_lock); diff --combined http.c index c7deccb6de,8e554c0969..256a5f15f4 --- a/http.c +++ b/http.c @@@ -218,13 -218,16 +218,16 @@@ static CURL* get_curl_handle(void return result; } - void http_init(void) + void http_init(struct remote *remote) { char *low_speed_limit; char *low_speed_time; curl_global_init(CURL_GLOBAL_ALL); + if (remote && remote->http_proxy) + curl_http_proxy = xstrdup(remote->http_proxy); + pragma_header = curl_slist_append(pragma_header, "Pragma: no-cache"); #ifdef USE_CURL_MULTI @@@ -281,15 -284,23 +284,15 @@@ void http_cleanup(void) { struct active_request_slot *slot = active_queue_head; -#ifdef USE_CURL_MULTI - char *wait_url; -#endif while (slot != NULL) { struct active_request_slot *next = slot->next; + if (slot->curl != NULL) { #ifdef USE_CURL_MULTI - if (slot->in_use) { - curl_easy_getinfo(slot->curl, - CURLINFO_EFFECTIVE_URL, - &wait_url); - fprintf(stderr, "Waiting for %s\n", wait_url); - run_active_slot(slot); - } + curl_multi_remove_handle(curlm, slot->curl); #endif - if (slot->curl != NULL) curl_easy_cleanup(slot->curl); + } free(slot); slot = next; } @@@ -306,6 -317,11 +309,11 @@@ curl_slist_free_all(pragma_header); pragma_header = NULL; + + if (curl_http_proxy) { + free(curl_http_proxy); + curl_http_proxy = NULL; + } } struct active_request_slot *get_active_slot(void)