Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2018-03-15 20:31:38 +0300
committerJunio C Hamano <gitster@pobox.com>2018-03-15 22:01:09 +0300
commit8ff14ed4127decbee3116aba59d7f8f897c4fe3b (patch)
tree19a7798c9d5169c47ab0667aa786330c72849a60 /http.c
parent49e85e95006e6a8e544372e529834319fcb0987c (diff)
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 <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r--http.c8
1 files changed, 8 insertions, 0 deletions
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");