@@ -150,7 +150,7 @@ static unsigned long empty_auth_useless =
150
150
151
151
static struct curl_slist * pragma_header ;
152
152
static struct curl_slist * no_pragma_header ;
153
- static struct curl_slist * extra_http_headers ;
153
+ static struct string_list extra_http_headers = STRING_LIST_INIT_DUP ;
154
154
155
155
static struct active_request_slot * active_queue_head ;
156
156
@@ -414,11 +414,9 @@ static int http_options(const char *var, const char *value, void *cb)
414
414
if (!value ) {
415
415
return config_error_nonbool (var );
416
416
} else if (!* value ) {
417
- curl_slist_free_all (extra_http_headers );
418
- extra_http_headers = NULL ;
417
+ string_list_clear (& extra_http_headers , 0 );
419
418
} else {
420
- extra_http_headers =
421
- curl_slist_append (extra_http_headers , value );
419
+ string_list_append (& extra_http_headers , value );
422
420
}
423
421
return 0 ;
424
422
}
@@ -1202,8 +1200,7 @@ void http_cleanup(void)
1202
1200
#endif
1203
1201
curl_global_cleanup ();
1204
1202
1205
- curl_slist_free_all (extra_http_headers );
1206
- extra_http_headers = NULL ;
1203
+ string_list_clear (& extra_http_headers , 0 );
1207
1204
1208
1205
curl_slist_free_all (pragma_header );
1209
1206
pragma_header = NULL ;
@@ -1627,10 +1624,11 @@ int run_one_slot(struct active_request_slot *slot,
1627
1624
1628
1625
struct curl_slist * http_copy_default_headers (void )
1629
1626
{
1630
- struct curl_slist * headers = NULL , * h ;
1627
+ struct curl_slist * headers = NULL ;
1628
+ const struct string_list_item * item ;
1631
1629
1632
- for ( h = extra_http_headers ; h ; h = h -> next )
1633
- headers = curl_slist_append (headers , h -> data );
1630
+ for_each_string_list_item ( item , & extra_http_headers )
1631
+ headers = curl_slist_append (headers , item -> string );
1634
1632
1635
1633
return headers ;
1636
1634
}
0 commit comments