Merge branch 'mh/maint-http-proxy-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 8 Mar 2008 10:20:37 +0000 (02:20 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 8 Mar 2008 10:20:37 +0000 (02:20 -0800)
* mh/maint-http-proxy-fix:
Set proxy override with http_init()

1  2 
http-push.c
http.c
diff --combined http-push.c
index f9b77d6021cf8df4b4d7a7a1efea3e63b5dcb477,869c01c75bfd9896aa6a4013701f55270958fff9..e3e34decd2d4bf3443a00026a5c63c9f93f38802
@@@ -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:");
  
                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 c7deccb6de6a8a57a2fb57734f05d6ffdc6ae9dc,8e554c09694456acc96dd9ba70c44870cb89f25d..256a5f15f40a8d9389560e1fb08e34a56e9f7140
--- 1/http.c
--- 2/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
  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;
        }
  
        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)