Merge pull request #62 from lwthiker/wrong_host_header

Fix bug causing a wrong 'Host' header
This commit is contained in:
lwthiker
2022-05-16 21:00:01 +03:00
committed by GitHub
2 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -523,7 +523,7 @@ index 04871ad1e..cd5998146 100644
{"HTTPPOST", CURLOPT_HTTPPOST, CURLOT_OBJECT, 0},
{"HTTPPROXYTUNNEL", CURLOPT_HTTPPROXYTUNNEL, CURLOT_LONG, 0},
diff --git a/lib/http.c b/lib/http.c
index f08a343e3..879151dd2 100644
index f08a343e3..2bbce4b23 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -84,6 +84,7 @@
@@ -671,16 +671,16 @@ index f08a343e3..879151dd2 100644
CURLcode Curl_http_useragent(struct Curl_easy *data)
{
/* The User-Agent string might have been allocated in url.c already, because
@@ -3067,6 +3163,11 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if(result)
return result;
@@ -3063,6 +3159,11 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
http = data->req.p.http;
DEBUGASSERT(http);
+ /* curl-impersonate: Add HTTP headers to impersonate real browsers. */
+ result = Curl_http_merge_headers(data);
+ if (result)
+ return result;
+
result = Curl_http_useragent(data);
result = Curl_http_host(data, conn);
if(result)
return result;
diff --git a/lib/http2.c b/lib/http2.c