aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Debuginfod/HTTPClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Debuginfod/HTTPClient.cpp')
-rw-r--r--llvm/lib/Debuginfod/HTTPClient.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Debuginfod/HTTPClient.cpp b/llvm/lib/Debuginfod/HTTPClient.cpp
index 3376eaa7cd0d..f9201e4f9626 100644
--- a/llvm/lib/Debuginfod/HTTPClient.cpp
+++ b/llvm/lib/Debuginfod/HTTPClient.cpp
@@ -111,9 +111,15 @@ Error HTTPClient::perform(const HTTPRequest &Request,
curl_easy_setopt(Curl, CURLOPT_URL, Url.c_str());
curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, Request.FollowRedirects);
+ curl_slist *Headers = nullptr;
+ for (const std::string &Header : Request.Headers)
+ Headers = curl_slist_append(Headers, Header.c_str());
+ curl_easy_setopt(Curl, CURLOPT_HTTPHEADER, Headers);
+
CurlHTTPRequest CurlRequest(Handler);
curl_easy_setopt(Curl, CURLOPT_WRITEDATA, &CurlRequest);
CURLcode CurlRes = curl_easy_perform(Curl);
+ curl_slist_free_all(Headers);
if (CurlRes != CURLE_OK)
return joinErrors(std::move(CurlRequest.ErrorState),
createStringError(errc::io_error,