summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-05-28 16:17:51 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-05-28 16:31:26 +0200
commit1248894a4ffd0d0ddcafec43a3f8a90c3bf9da0d (patch)
tree24381f33f36ced0c0388267d2829faa4357d1fe0
parent2f11fbf208c78d38e9a19b1224238c4ecff5989f (diff)
downloadcurl-bagder/url-conn-port.tar.gz
url: default conn->port to the same as conn->remote_portbagder/url-conn-port
... so that it has a sensible value when ConnectionExists() is called which needs it set to differentiate host "bundles" correctly on port number! Also, make conncache:hashkey() use correct port for bundles that are proxy vs host connections. Probably a regression from 7.62.0 Reported-by: Tom van der Woerdt Fixes #3956
-rw-r--r--lib/conncache.c7
-rw-r--r--lib/url.c2
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/conncache.c b/lib/conncache.c
index 2cdfd34d9..88463354b 100644
--- a/lib/conncache.c
+++ b/lib/conncache.c
@@ -163,9 +163,12 @@ static void hashkey(struct connectdata *conn, char *buf,
const char **hostp)
{
const char *hostname;
+ long port = conn->remote_port;
- if(conn->bits.httpproxy && !conn->bits.tunnel_proxy)
+ if(conn->bits.httpproxy && !conn->bits.tunnel_proxy) {
hostname = conn->http_proxy.host.name;
+ port = conn->port;
+ }
else if(conn->bits.conn_to_host)
hostname = conn->conn_to_host.name;
else
@@ -178,7 +181,7 @@ static void hashkey(struct connectdata *conn, char *buf,
DEBUGASSERT(len > 32);
/* put the number first so that the hostname gets cut off if too long */
- msnprintf(buf, len, "%ld%s", conn->port, hostname);
+ msnprintf(buf, len, "%ld%s", port, hostname);
}
void Curl_conncache_unlock(struct Curl_easy *data)
diff --git a/lib/url.c b/lib/url.c
index 88d72bfea..51515c924 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2027,7 +2027,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
else {
unsigned long port = strtoul(data->state.up.port, NULL, 10);
- conn->remote_port = curlx_ultous(port);
+ conn->port = conn->remote_port = curlx_ultous(port);
}
(void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);