preproxy: renamed what was added as SOCKS_PROXY

CURLOPT_SOCKS_PROXY -> CURLOPT_PRE_PROXY

Added the corresponding --preroxy command line option. Sets a SOCKS
proxy to connect to _before_ connecting to a HTTP(S) proxy.
This commit is contained in:
Daniel Stenberg 2016-12-16 16:02:08 +01:00
parent 642398c651
commit 845522cadb
12 changed files with 80 additions and 29 deletions

View file

@ -150,7 +150,7 @@ static void free_config_fields(struct OperationConfig *config)
curl_slist_free_all(config->resolve);
curl_slist_free_all(config->connect_to);
Curl_safefree(config->socksproxy);
Curl_safefree(config->preproxy);
Curl_safefree(config->proxy_service_name);
Curl_safefree(config->service_name);

View file

@ -178,9 +178,7 @@ struct OperationConfig {
bool ftp_ssl_control;
bool ftp_ssl_ccc;
int ftp_ssl_ccc_mode;
char *socksproxy; /* set to server string */
char *preproxy;
int socks5_gssapi_nec; /* The NEC reference server does not protect the
encryption type exchange */
char *proxy_service_name; /* set authentication service name for HTTP and

View file

@ -290,6 +290,7 @@ static const struct LongShort aliases[]= {
{"V", "version", FALSE},
{"w", "write-out", TRUE},
{"x", "proxy", TRUE},
{"xa", "preproxy", TRUE},
{"X", "request", TRUE},
{"Y", "speed-limit", TRUE},
{"y", "speed-time", TRUE},
@ -1920,9 +1921,16 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&config->writeout, nextarg);
break;
case 'x':
/* proxy */
GetStr(&config->proxy, nextarg);
config->proxyver = CURLPROXY_HTTP;
switch(subletter) {
case 'a': /* --preproxy */
GetStr(&config->preproxy, nextarg);
break;
default:
/* --proxy */
GetStr(&config->proxy, nextarg);
config->proxyver = CURLPROXY_HTTP;
break;
}
break;
case 'X':
/* set custom request */

View file

@ -168,6 +168,7 @@ static const char *const helptext[] = {
"Do not switch to GET after following a 302 redirect (H)",
" --post303 "
"Do not switch to GET after following a 303 redirect (H)",
" --preproxy [PROTOCOL://]HOST[:PORT] Proxy before HTTP(S) proxy",
" -#, --progress-bar Display transfer progress as a progress bar",
" --proto PROTOCOLS Enable/disable PROTOCOLS",
" --proto-default PROTOCOL Use PROTOCOL for any URL missing a scheme",

View file

@ -868,8 +868,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel?1L:0L);
/* new in libcurl 7.52.0 */
if(config->socksproxy)
my_setopt_str(curl, CURLOPT_SOCKS_PROXY, config->socksproxy);
if(config->preproxy)
my_setopt_str(curl, CURLOPT_PRE_PROXY, config->preproxy);
/* new in libcurl 7.10.6 */
if(config->proxyanyauth)