From 0ff89b9c3c02a911e1e5ea9a4182c373a6e0f1c7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 27 Sep 2002 09:49:40 +0000 Subject: Allow a "" proxy explicitly set dont-use-proxy, i.e don't even check the environment variables or anything. Setting it to NULL disables proxy as well, but allows the environment variables to kick in and be used. --- lib/url.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/url.c b/lib/url.c index bbf9e4bbc..744a0c4fb 100644 --- a/lib/url.c +++ b/lib/url.c @@ -731,7 +731,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) break; case CURLOPT_PROXY: /* - * Set proxy server:port to use as HTTP proxy + * Set proxy server:port to use as HTTP proxy. + * + * If the proxy is set to "" we explicitly say that we don't want to use a + * proxy (even though there might be environment variables saying so). + * + * Setting it to NULL, means no proxy but allows the environment variables + * to decide for us. */ if(data->change.proxy_alloc) { /* @@ -2137,6 +2143,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, conn->protocol |= PROT_FTP; if(data->change.proxy && + *data->change.proxy && !data->set.tunnel_thru_httpproxy) { /* Unless we have asked to tunnel ftp operations through the proxy, we switch and use HTTP operations only */ @@ -2316,7 +2323,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, } } - if(data->change.proxy) { + if(data->change.proxy && *data->change.proxy) { /* If this is supposed to use a proxy, we need to figure out the proxy host name name, so that we can re-use an existing connection that may exist registered to the same proxy host. */ @@ -2630,7 +2637,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /* re-used connection, no resolving is necessary */ hostaddr = NULL; } - else if(!data->change.proxy) { + else if(!data->change.proxy || !*data->change.proxy) { /* If not connecting via a proxy, extract the port from the URL, if it is * there, thus overriding any defaults that might have been set above. */ conn->port = conn->remote_port; /* it is the same port */ @@ -2720,7 +2727,8 @@ static CURLcode CreateConnection(struct SessionHandle *data, * Send user-agent to HTTP proxies even if the target protocol * isn't HTTP. *************************************************************/ - if((conn->protocol&PROT_HTTP) || data->change.proxy) { + if((conn->protocol&PROT_HTTP) || + (data->change.proxy && *data->change.proxy)) { if(data->set.useragent) { if(conn->allocptr.uagent) free(conn->allocptr.uagent); -- cgit v1.2.3