From f3ab5d5500f81b052e215b60fe55dcf88fe6635f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 29 Sep 2008 21:46:04 +0000 Subject: - Daniel Egger provided a patch that allows you to disable proxy support in libcurl to somewhat reduce the size of the binary. Run configure --disable-proxy. --- lib/ftp.c | 8 +++++--- lib/socks.c | 4 ++++ lib/url.c | 13 +++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/ftp.c b/lib/ftp.c index 7f1e51205..1ec4091cb 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1876,14 +1876,12 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, ftp_pasv_verbose(conn, conninfo, newhost, connectport); switch(data->set.proxytype) { +#ifndef CURL_DISABLE_PROXY case CURLPROXY_SOCKS5: case CURLPROXY_SOCKS5_HOSTNAME: result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, newhost, newport, SECONDARYSOCKET, conn); break; - case CURLPROXY_HTTP: - /* do nothing here. handled later. */ - break; case CURLPROXY_SOCKS4: result = Curl_SOCKS4(conn->proxyuser, newhost, newport, SECONDARYSOCKET, conn, FALSE); @@ -1892,6 +1890,10 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, result = Curl_SOCKS4(conn->proxyuser, newhost, newport, SECONDARYSOCKET, conn, TRUE); break; +#endif /* CURL_DISABLE_PROXY */ + case CURLPROXY_HTTP: + /* do nothing here. handled later. */ + break; default: failf(data, "unknown proxytype option given"); result = CURLE_COULDNT_CONNECT; diff --git a/lib/socks.c b/lib/socks.c index 9bbb0a7f4..693573209 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -23,6 +23,7 @@ #include "setup.h" +#ifndef CURL_DISABLE_PROXY #include #ifdef NEED_MALLOC_H @@ -686,3 +687,6 @@ CURLcode Curl_SOCKS5(const char *proxy_name, Curl_nonblock(sock, TRUE); return CURLE_OK; /* Proxy was successful! */ } + +#endif /* CURL_DISABLE_PROXY */ + diff --git a/lib/url.c b/lib/url.c index df3e3cafc..51bfbf6a7 100644 --- a/lib/url.c +++ b/lib/url.c @@ -2666,17 +2666,14 @@ static CURLcode ConnectPlease(struct SessionHandle *data, result = Curl_store_ip_addr(conn); if(CURLE_OK == result) { - switch(data->set.proxytype) { +#ifndef CURL_DISABLE_PROXY case CURLPROXY_SOCKS5: case CURLPROXY_SOCKS5_HOSTNAME: result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn->host.name, conn->remote_port, FIRSTSOCKET, conn); break; - case CURLPROXY_HTTP: - /* do nothing here. handled later. */ - break; case CURLPROXY_SOCKS4: result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port, FIRSTSOCKET, conn, FALSE); @@ -2685,6 +2682,10 @@ static CURLcode ConnectPlease(struct SessionHandle *data, result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port, FIRSTSOCKET, conn, TRUE); break; +#endif /* CURL_DISABLE_PROXY */ + case CURLPROXY_HTTP: + /* do nothing here. handled later. */ + break; default: failf(data, "unknown proxytype option given"); result = CURLE_COULDNT_CONNECT; @@ -3237,6 +3238,7 @@ static CURLcode setup_connection_internals(struct SessionHandle *data, return CURLE_UNSUPPORTED_PROTOCOL; } +#ifndef CURL_DISABLE_PROXY /**************************************************************** * Detect what (if any) proxy to use. Remember that this selects a host * name and is not limited to HTTP proxies only. @@ -3513,6 +3515,7 @@ static CURLcode parse_proxy_auth(struct SessionHandle *data, return CURLE_OK; } +#endif /* CURL_DISABLE_PROXY */ /* * @@ -4040,6 +4043,7 @@ static CURLcode create_conn(struct SessionHandle *data, return result; } +#ifndef CURL_DISABLE_PROXY /************************************************************* * Extract the user and password from the authentication string *************************************************************/ @@ -4068,6 +4072,7 @@ static CURLcode create_conn(struct SessionHandle *data, proxy = NULL; } /* proxy must be freed later unless NULL */ +#endif /* CURL_DISABLE_PROXY */ /************************************************************* * No protocol part in URL was used, add it! -- cgit v1.2.3