@matheusbsbs / matheus-bagliano / commits / b3ca4e4ebb
Fork 0

HTTP cleanup

Fix broken build when USE_CURL_MULTI is not defined, as noted by Becky Bruce. During cleanup, free header slist that was created during init, as noted by Junio. Signed-off-by: Nick Hengeveld <nickh@reactrix.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Nick Hengeveld committed Jun 6, 2006 at 09:41 UTC b3ca4e4ebba6915ea534c4b82cfc5d6f10b4c283
2 files changed +14 -1
http-push.c
+8
@@ -788,6 +788,7 @@ static void finish_request(struct transfer_request *request)
788 }
789 }
790
791 +#ifdef USE_CURL_MULTI
792 void fill_active_slots(void)
793 {
794 struct transfer_request *request = request_queue_head;
@@ -821,6 +822,7 @@ void fill_active_slots(void)
822 slot = slot->next;
823 }
824 }
825 +#endif
826
827 static void get_remote_object_list(unsigned char parent);
828
@@ -851,8 +853,10 @@ static void add_fetch_request(struct object *obj)
853 request->next = request_queue_head;
854 request_queue_head = request;
855
856 +#ifdef USE_CURL_MULTI
857 fill_active_slots();
858 step_active_slots();
859 +#endif
860 }
861
862 static int add_send_request(struct object *obj, struct remote_lock *lock)
@@ -889,8 +893,10 @@ static int add_send_request(struct object *obj, struct remote_lock *lock)
893 request->next = request_queue_head;
894 request_queue_head = request;
895
896 +#ifdef USE_CURL_MULTI
897 fill_active_slots();
898 step_active_slots();
899 +#endif
900
901 return 1;
902 }
@@ -2523,7 +2529,9 @@ int main(int argc, char **argv)
2529 if (objects_to_send)
2530 fprintf(stderr, " sending %d objects\n",
2531 objects_to_send);
2532 +#ifdef USE_CURL_MULTI
2533 fill_active_slots();
2534 +#endif
2535 finish_all_active_slots();
2536
2537 /* Update the remote branch if all went well */
http.c
+6 -1
@@ -286,7 +286,8 @@ void http_cleanup(void)
286 curl_multi_cleanup(curlm);
287 #endif
288 curl_global_cleanup();
289 -
289 +
290 + curl_slist_free_all(pragma_header);
291 }
292
293 struct active_request_slot *get_active_slot(void)
@@ -438,11 +439,15 @@ void release_active_slot(struct active_request_slot *slot)
439 {
440 closedown_active_slot(slot);
441 if (slot->curl) {
442 +#ifdef USE_CURL_MULTI
443 curl_multi_remove_handle(curlm, slot->curl);
444 +#endif
445 curl_easy_cleanup(slot->curl);
446 slot->curl = NULL;
447 }
448 +#ifdef USE_CURL_MULTI
449 fill_active_slots();
450 +#endif
451 }
452
453 static void finish_active_slot(struct active_request_slot *slot)