From 8ff14ed4127decbee3116aba59d7f8f897c4fe3b Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 15 Mar 2018 10:31:38 -0700 Subject: http: allow providing extra headers for http requests Add a way for callers to request that extra headers be included when making http requests. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- http.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'http.c') diff --git a/http.c b/http.c index 32d33261c9..a4c16a91e6 100644 --- a/http.c +++ b/http.c @@ -1723,6 +1723,14 @@ static int http_request(const char *url, headers = curl_slist_append(headers, buf.buf); + /* Add additional headers here */ + if (options && options->extra_headers) { + const struct string_list_item *item; + for_each_string_list_item(item, options->extra_headers) { + headers = curl_slist_append(headers, item->string); + } + } + curl_easy_setopt(slot->curl, CURLOPT_URL, url); curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "gzip"); -- cgit v1.2.3