55#include "http.h"
66
77#define PREV_BUF_SIZE 4096
8- #define RANGE_HEADER_SIZE 30
98
109struct alt_base
1110{
@@ -57,7 +56,6 @@ struct walker_data {
5756 const char * url ;
5857 int got_alternates ;
5958 struct alt_base * alt ;
60- struct curl_slist * no_pragma_header ;
6159};
6260
6361static struct object_request * object_queue_head ;
@@ -108,7 +106,6 @@ static void start_object_request(struct walker *walker,
108106 char range [RANGE_HEADER_SIZE ];
109107 struct curl_slist * range_header = NULL ;
110108 struct active_request_slot * slot ;
111- struct walker_data * data = walker -> data ;
112109
113110 snprintf (prevfile , sizeof (prevfile ), "%s.prev" , obj_req -> filename );
114111 unlink_or_warn (prevfile );
@@ -205,7 +202,7 @@ static void start_object_request(struct walker *walker,
205202 curl_easy_setopt (slot -> curl , CURLOPT_WRITEFUNCTION , fwrite_sha1_file );
206203 curl_easy_setopt (slot -> curl , CURLOPT_ERRORBUFFER , obj_req -> errorstr );
207204 curl_easy_setopt (slot -> curl , CURLOPT_URL , url );
208- curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , data -> no_pragma_header );
205+ curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , no_pragma_header );
209206
210207 /*
211208 * If we have successfully processed data from a previous fetch
@@ -354,6 +351,8 @@ static void prefetch(struct walker *walker, unsigned char *sha1)
354351 newreq -> slot = NULL ;
355352 newreq -> next = NULL ;
356353
354+ http_is_verbose = walker -> get_verbosely ;
355+
357356 if (object_queue_head == NULL ) {
358357 object_queue_head = newreq ;
359358 } else {
@@ -379,7 +378,6 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch
379378 long prev_posn = 0 ;
380379 char range [RANGE_HEADER_SIZE ];
381380 struct curl_slist * range_header = NULL ;
382- struct walker_data * data = walker -> data ;
383381
384382 FILE * indexfile ;
385383 struct active_request_slot * slot ;
@@ -430,7 +428,7 @@ static int fetch_index(struct walker *walker, struct alt_base *repo, unsigned ch
430428 curl_easy_setopt (slot -> curl , CURLOPT_FILE , indexfile );
431429 curl_easy_setopt (slot -> curl , CURLOPT_WRITEFUNCTION , fwrite );
432430 curl_easy_setopt (slot -> curl , CURLOPT_URL , url );
433- curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , data -> no_pragma_header );
431+ curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , no_pragma_header );
434432 slot -> local = indexfile ;
435433
436434 /*
@@ -768,7 +766,6 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
768766 long prev_posn = 0 ;
769767 char range [RANGE_HEADER_SIZE ];
770768 struct curl_slist * range_header = NULL ;
771- struct walker_data * data = walker -> data ;
772769
773770 struct active_request_slot * slot ;
774771 struct slot_results results ;
@@ -802,7 +799,7 @@ static int fetch_pack(struct walker *walker, struct alt_base *repo, unsigned cha
802799 curl_easy_setopt (slot -> curl , CURLOPT_FILE , packfile );
803800 curl_easy_setopt (slot -> curl , CURLOPT_WRITEFUNCTION , fwrite );
804801 curl_easy_setopt (slot -> curl , CURLOPT_URL , url );
805- curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , data -> no_pragma_header );
802+ curl_easy_setopt (slot -> curl , CURLOPT_HTTPHEADER , no_pragma_header );
806803 slot -> local = packfile ;
807804
808805 /*
@@ -948,10 +945,7 @@ static int fetch_ref(struct walker *walker, struct ref *ref)
948945
949946static void cleanup (struct walker * walker )
950947{
951- struct walker_data * data = walker -> data ;
952948 http_cleanup ();
953-
954- curl_slist_free_all (data -> no_pragma_header );
955949}
956950
957951struct walker * get_http_walker (const char * url , struct remote * remote )
@@ -962,8 +956,6 @@ struct walker *get_http_walker(const char *url, struct remote *remote)
962956
963957 http_init (remote );
964958
965- data -> no_pragma_header = curl_slist_append (NULL , "Pragma:" );
966-
967959 data -> alt = xmalloc (sizeof (* data -> alt ));
968960 data -> alt -> base = xmalloc (strlen (url ) + 1 );
969961 strcpy (data -> alt -> base , url );
0 commit comments