aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-11-05 22:31:40 +0100
committerDaniel Stenberg <daniel@haxx.se>2010-11-08 08:56:21 +0100
commit1b24b89cca3c06e36b69969af8edeeaca659515b (patch)
treebaa8fdb1a290d28e7bf7ca54ca8fd482dc98c3dc /src/main.c
parentdc3e7df1c99c2ee9dae06453adbb94fe9584bf75 (diff)
CURLOPT_RESOLVE: added
CURLOPT_RESOLVE is a new option that sends along a curl_slist with name:port:address sets that will populate the DNS cache with entries so that request can be "fooled" to use another host than what otherwise would've been used. Previously we've encouraged the use of Host: for that when dealing with HTTP, but this new feature has the added bonus that it allows the name from the URL to be used for TLS SNI and server certificate name checks as well. This is a first change. Surely more will follow to make it decent.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 79a2b30a6..91875e311 100644
--- a/src/main.c
+++ b/src/main.c
@@ -581,6 +581,7 @@ struct Configurable {
struct curl_httppost *httppost;
struct curl_httppost *last_post;
struct curl_slist *telnet_options;
+ struct curl_slist *resolve;
HttpReq httpreq;
/* for bandwidth limiting features: */
@@ -869,6 +870,7 @@ static void help(void)
" --remote-name-all Use the remote file name for all URLs",
" -R/--remote-time Set the remote file's time on the local output",
" -X/--request <command> Specify request command to use",
+ " --resolve <host:port:address> Force resolve of HOST:PORT to ADDRESS",
" --retry <num> Retry request <num> times if transient problems occur",
" --retry-delay <seconds> When retrying, wait this many seconds between each",
" --retry-max-time <seconds> Retry only within this period",
@@ -1881,6 +1883,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"$C", "ftp-pret", FALSE},
{"$D", "proto", TRUE},
{"$E", "proto-redir", TRUE},
+ {"$F", "resolve", TRUE},
{"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE},
{"2", "sslv2", FALSE},
@@ -2442,6 +2445,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
if(proto2num(config, &config->proto_redir, nextarg))
return PARAM_BAD_USE;
break;
+ case 'F': /* --resolve */
+ err = add2list(&config->resolve, nextarg);
+ break;
}
break;
case '#': /* --progress-bar */
@@ -4043,6 +4049,7 @@ static void free_config_fields(struct Configurable *config)
curl_slist_free_all(config->headers);
curl_slist_free_all(config->telnet_options);
curl_slist_free_all(config->mail_rcpt);
+ curl_slist_free_all(config->resolve);
if(config->easy)
curl_easy_cleanup(config->easy);
@@ -5438,6 +5445,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
my_setopt(curl, CURLOPT_HEADERDATA, &outs);
}
+ if(config->resolve)
+ /* new in 7.21.3 */
+ my_setopt(curl, CURLOPT_RESOLVE, config->resolve);
+
retry_numretries = config->req_retry;
retrystart = cutil_tvnow();