diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-01-30 08:51:24 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-01-30 08:51:24 +0000 |
commit | 50c80a49ccbcc95019e08f7cdb90d20f2429f9ea (patch) | |
tree | e86d4e9a42d385b151c6f3405d87754f6d071253 /src | |
parent | 6b7f169b101654a7abe8cda6da75a88dccdd8e6d (diff) |
Added --socks
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index c6a1d58a2..7fc6088a2 100644 --- a/src/main.c +++ b/src/main.c @@ -335,6 +335,7 @@ static void help(void) " -R/--remote-time Set the remote file's time on the local output", " -s/--silent Silent mode. Don't output anything", " -S/--show-error Show error. With -s, make curl show errors when they occur", + " --socks <host[:port]> Use SOCKS5 proxy on given host + port", " --stderr <file> Where to redirect stderr. - means stdout", " -t/--telnet-option <OPT=val> Set telnet option", " --trace <file> Dump a network/debug trace to the given file", @@ -481,6 +482,8 @@ struct Configurable { size_t lastrecvsize; bool ftp_ssl; + + char *socks5proxy; }; /* global variable to hold info about libcurl */ @@ -1113,6 +1116,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ {"*z", "disable-eprt", FALSE}, {"$a", "ftp-ssl", FALSE}, {"$b", "ftp-pasv", FALSE}, + {"$c", "socks5", TRUE}, {"0", "http1.0", FALSE}, {"1", "tlsv1", FALSE}, {"2", "sslv2", FALSE}, @@ -1433,6 +1437,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ free(config->ftpport); config->ftpport = NULL; break; + case 'c': /* --socks specifies a socks5 proxy to use */ + GetStr(&config->socks5proxy, nextarg); + break; } break; case '#': /* added 19990617 larsa */ @@ -3250,10 +3257,16 @@ operate(struct Configurable *config, int argc, char *argv[]) curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, config->max_filesize); - /* new in curl 7.10.9 */ + /* new in curl 7.11.0 */ if(config->ftp_ssl) curl_easy_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_TRY); + /* new in curl 7.11.1 */ + if(config->socks5proxy) { + curl_easy_setopt(curl, CURLOPT_PROXY, config->socks5proxy); + curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5); + } + res = curl_easy_perform(curl); if((config->progressmode == CURL_PROGRESS_BAR) && |