aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/tool_cfgable.c1
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c6
-rw-r--r--src/tool_help.c1
-rw-r--r--src/tool_operate.c4
5 files changed, 13 insertions, 0 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index 4517714cd..8b60a91b7 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -135,6 +135,7 @@ static void free_config_fields(struct OperationConfig *config)
curl_slist_free_all(config->telnet_options);
curl_slist_free_all(config->resolve);
+ curl_slist_free_all(config->connect_to);
Curl_safefree(config->socksproxy);
Curl_safefree(config->proxy_service_name);
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index ba91062c6..e6f4e840d 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -151,6 +151,7 @@ struct OperationConfig {
struct curl_httppost *last_post;
struct curl_slist *telnet_options;
struct curl_slist *resolve;
+ struct curl_slist *connect_to;
HttpReq httpreq;
/* for bandwidth limiting features: */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 70290d19e..3dea7a775 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -183,6 +183,7 @@ static const struct LongShort aliases[]= {
{"$Q", "proto-default", TRUE},
{"$R", "expect100-timeout", TRUE},
{"$S", "tftp-no-options", FALSE},
+ {"$U", "connect-to", TRUE},
{"0", "http1.0", FALSE},
{"01", "http1.1", FALSE},
{"02", "http2", FALSE},
@@ -1009,6 +1010,11 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
case 'S': /* --tftp-no-options */
config->tftp_no_options = toggle;
break;
+ case 'U': /* --connect-to */
+ err = add2list(&config->connect_to, nextarg);
+ if(err)
+ return err;
+ break;
}
break;
case '#': /* --progress-bar */
diff --git a/src/tool_help.c b/src/tool_help.c
index 42159f4d9..8b4551ba2 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -58,6 +58,7 @@ static const char *const helptext[] = {
" --compressed Request compressed response (using deflate or gzip)",
" -K, --config FILE Read config from FILE",
" --connect-timeout SECONDS Maximum time allowed for connection",
+ " --connect-to HOST1:PORT1:HOST2:PORT2 Connect to host (network level)",
" -C, --continue-at OFFSET Resumed transfer OFFSET",
" -b, --cookie STRING/FILE Read cookies from STRING/FILE (H)",
" -c, --cookie-jar FILE Write cookies to FILE after operation (H)",
diff --git a/src/tool_operate.c b/src/tool_operate.c
index c8bf12bb2..deabf90b3 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1305,6 +1305,10 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* new in 7.21.3 */
my_setopt_slist(curl, CURLOPT_RESOLVE, config->resolve);
+ if(config->connect_to)
+ /* new in 7.49.0 */
+ my_setopt_slist(curl, CURLOPT_CONNECT_TO, config->connect_to);
+
/* new in 7.21.4 */
if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) {
if(config->tls_username)