summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-01-01 23:41:21 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-01-02 23:40:47 +0100
commit648712eec1eedb05965b9b4d6dd457bda5d70481 (patch)
treee696618bd90aa6ccbc743f88b72e760045fc8c56 /lib/url.c
parent725ec470e2ca5b1eb01ffee84d432653a8070722 (diff)
downloadcurl-648712eec1eedb05965b9b4d6dd457bda5d70481.tar.gz
httpauth: make multi-request auth work with custom port
When doing HTTP authentication and a port number set with CURLOPT_PORT, the code would previously have the URL's port number override as if it had been a redirect to an absolute URL. Added test 1568 to verify. Reported-by: UrsusArctos on github Fixes #6397 Closes #6400
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/url.c b/lib/url.c
index fd9237de4..45577713e 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2003,7 +2003,9 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
else {
unsigned long port = strtoul(data->state.up.port, NULL, 10);
- conn->port = conn->remote_port = curlx_ultous(port);
+ conn->port = conn->remote_port =
+ (data->set.use_port && data->state.allow_port) ?
+ (int)data->set.use_port : curlx_ultous(port);
}
(void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);