From a6183ab23a702f45b14affe7ab25996960cd8b1b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 28 May 2019 16:17:51 +0200 Subject: url: default conn->port to the same as conn->remote_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 Closes #3957 --- lib/conncache.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/conncache.c') 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) -- cgit v1.2.1