summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2020-07-23 03:16:14 -0400
committerJay Satiro <raysatiro@yahoo.com>2020-07-30 11:57:35 -0400
commita12a16151aa33dfd5e7627d4bfc2dc1673a7bf8e (patch)
treeabb58424abeb0526a63655d3083a4c5c9cc43870 /lib/url.c
parentd8b8afe320ee2cda0906f1c69873b38bca872e74 (diff)
downloadcurl-a12a16151aa33dfd5e7627d4bfc2dc1673a7bf8e.tar.gz
url: fix CURLU and location following
Prior to this change if the user set a URL handle (CURLOPT_CURLU) it was incorrectly used for the location follow, resulting in infinite requests to the original location. Reported-by: sspiri@users.noreply.github.com Fixes https://github.com/curl/curl/issues/5709 Closes https://github.com/curl/curl/pull/5713
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/url.c b/lib/url.c
index caeb429a5..a98aab27f 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1836,11 +1836,12 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
CURLU *uh;
CURLUcode uc;
char *hostname;
+ bool use_set_uh = (data->set.uh && !data->state.this_is_a_follow);
up_free(data); /* cleanup previous leftovers first */
/* parse the URL */
- if(data->set.uh) {
+ if(use_set_uh) {
uh = data->state.uh = curl_url_dup(data->set.uh);
}
else {
@@ -1863,7 +1864,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
data->change.url_alloc = TRUE;
}
- if(!data->set.uh) {
+ if(!use_set_uh) {
char *newurl;
uc = curl_url_set(uh, CURLUPART_URL, data->change.url,
CURLU_GUESS_SCHEME |