From 50c80a49ccbcc95019e08f7cdb90d20f2429f9ea Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 30 Jan 2004 08:51:24 +0000 Subject: [PATCH] Added --socks --- CHANGES | 6 ++++++ src/main.c | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 01376d0..ca11610 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,12 @@ 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) - Stadler Stephan pointed out that src/hugehelp.c included config.h without checking the define if its present... diff --git a/src/main.c b/src/main.c index c6a1d58..7fc6088 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) && -- 2.7.4