From 50c80a49ccbcc95019e08f7cdb90d20f2429f9ea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 30 Jan 2004 08:51:24 +0000 Subject: Added --socks --- src/main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/main.c') 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 Use SOCKS5 proxy on given host + port", " --stderr Where to redirect stderr. - means stdout", " -t/--telnet-option Set telnet option", " --trace 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) && -- cgit v1.2.3