1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Added --socks

This commit is contained in:
Daniel Stenberg 2004-01-30 08:51:24 +00:00
parent 6b7f169b10
commit 50c80a49cc
2 changed files with 20 additions and 1 deletions

View File

@ -6,6 +6,12 @@
Changelog Changelog
Daniel(30 January 2004)
- Added --socks as a recognized option. It works just like --proxy but sets a
SOCKS5 proxy to use. SOCKS5 support has been available in libcurl for a
while, just not provided by the curl tool. This does not currently work for
IPv6-enabled libcurls.
Daniel(29 January 2004) Daniel(29 January 2004)
- Stadler Stephan pointed out that src/hugehelp.c included config.h without - Stadler Stephan pointed out that src/hugehelp.c included config.h without
checking the define if its present... checking the define if its present...

View File

@ -335,6 +335,7 @@ static void help(void)
" -R/--remote-time Set the remote file's time on the local output", " -R/--remote-time Set the remote file's time on the local output",
" -s/--silent Silent mode. Don't output anything", " -s/--silent Silent mode. Don't output anything",
" -S/--show-error Show error. With -s, make curl show errors when they occur", " -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", " --stderr <file> Where to redirect stderr. - means stdout",
" -t/--telnet-option <OPT=val> Set telnet option", " -t/--telnet-option <OPT=val> Set telnet option",
" --trace <file> Dump a network/debug trace to the given file", " --trace <file> Dump a network/debug trace to the given file",
@ -481,6 +482,8 @@ struct Configurable {
size_t lastrecvsize; size_t lastrecvsize;
bool ftp_ssl; bool ftp_ssl;
char *socks5proxy;
}; };
/* global variable to hold info about libcurl */ /* global variable to hold info about libcurl */
@ -1113,6 +1116,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"*z", "disable-eprt", FALSE}, {"*z", "disable-eprt", FALSE},
{"$a", "ftp-ssl", FALSE}, {"$a", "ftp-ssl", FALSE},
{"$b", "ftp-pasv", FALSE}, {"$b", "ftp-pasv", FALSE},
{"$c", "socks5", TRUE},
{"0", "http1.0", FALSE}, {"0", "http1.0", FALSE},
{"1", "tlsv1", FALSE}, {"1", "tlsv1", FALSE},
{"2", "sslv2", FALSE}, {"2", "sslv2", FALSE},
@ -1433,6 +1437,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
free(config->ftpport); free(config->ftpport);
config->ftpport = NULL; config->ftpport = NULL;
break; break;
case 'c': /* --socks specifies a socks5 proxy to use */
GetStr(&config->socks5proxy, nextarg);
break;
} }
break; break;
case '#': /* added 19990617 larsa */ case '#': /* added 19990617 larsa */
@ -3250,10 +3257,16 @@ operate(struct Configurable *config, int argc, char *argv[])
curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE, curl_easy_setopt(curl, CURLOPT_MAXFILESIZE_LARGE,
config->max_filesize); config->max_filesize);
/* new in curl 7.10.9 */ /* new in curl 7.11.0 */
if(config->ftp_ssl) if(config->ftp_ssl)
curl_easy_setopt(curl, CURLOPT_FTP_SSL, CURLFTPSSL_TRY); 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); res = curl_easy_perform(curl);
if((config->progressmode == CURL_PROGRESS_BAR) && if((config->progressmode == CURL_PROGRESS_BAR) &&