summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-09-27 09:49:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-09-27 09:49:40 +0000
commit0ff89b9c3c02a911e1e5ea9a4182c373a6e0f1c7 (patch)
treeccbbd10792d747be3a76dd50716f4ef118cdc28e
parent3b33540c997df1e5bda343c7cf89b7990e9a0c54 (diff)
downloadgnurl-0ff89b9c3c02a911e1e5ea9a4182c373a6e0f1c7.tar.gz
gnurl-0ff89b9c3c02a911e1e5ea9a4182c373a6e0f1c7.tar.bz2
gnurl-0ff89b9c3c02a911e1e5ea9a4182c373a6e0f1c7.zip
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.
-rw-r--r--lib/url.c16
1 files 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);