aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.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/connect.c
parentf86f50f05a466f8960d94179ca46e9561458c567 (diff)
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/connect.c')
-rw-r--r--lib/connect.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 567186a69..3f3d3f65f 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -841,6 +841,8 @@ CURLcode Curl_is_connected(struct connectdata *conn,
if(result) {
/* no more addresses to try */
+ const char* hostname;
+
/* if the first address family runs out of addresses to try before
the happy eyeball timeout, go ahead and try the next family now */
if(conn->tempaddr[1] == NULL) {
@@ -849,9 +851,15 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return result;
}
+ 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;
+
failf(data, "Failed to connect to %s port %ld: %s",
- conn->bits.proxy?conn->proxy.name:conn->host.name,
- conn->port, Curl_strerror(conn, error));
+ hostname, conn->port, Curl_strerror(conn, error));
}
return result;