From 1b24b89cca3c06e36b69969af8edeeaca659515b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 5 Nov 2010 22:31:40 +0100 Subject: 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. --- src/main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/main.c') 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 Specify request command to use", + " --resolve Force resolve of HOST:PORT to ADDRESS", " --retry Retry request times if transient problems occur", " --retry-delay When retrying, wait this many seconds between each", " --retry-max-time 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(); -- cgit v1.2.3