summaryrefslogtreecommitdiff
path: root/lib/conncache.c
diff options
context:
space:
mode:
authorMichael Kaufmann <mail@michael-kaufmann.ch>2016-01-25 14:37:24 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-04-17 23:50:59 +0200
commitcd8d23624594e21c37a0453459229a90a38ad471 (patch)
tree57afa8a5d73bffd4f3b08ef691d68ff2d03d4c7f /lib/conncache.c
parentf86f50f05a466f8960d94179ca46e9561458c567 (diff)
downloadcurl-cd8d23624594e21c37a0453459229a90a38ad471.tar.gz
news: CURLOPT_CONNECT_TO and --connect-to
Makes curl connect to the given host+port instead of the host+port found in the URL.
Diffstat (limited to 'lib/conncache.c')
-rw-r--r--lib/conncache.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/conncache.c b/lib/conncache.c
index 6e03caf3c..89086590a 100644
--- a/lib/conncache.c
+++ b/lib/conncache.c
@@ -132,9 +132,16 @@ void Curl_conncache_destroy(struct conncache *connc)
/* returns an allocated key to find a bundle for this connection */
static char *hashkey(struct connectdata *conn)
{
- return aprintf("%s:%d",
- conn->bits.proxy?conn->proxy.name:conn->host.name,
- conn->localport);
+ const char *hostname;
+
+ if(conn->bits.proxy)
+ hostname = conn->proxy.name;
+ else if(conn->bits.conn_to_host)
+ hostname = conn->conn_to_host.name;
+ else
+ hostname = conn->host.name;
+
+ return aprintf("%s:%d", hostname, conn->localport);
}
/* Look up the bundle with all the connections to the same host this