aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-03-14 14:11:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-03-14 14:11:11 +0000
commitf8e1fc32de60c5f4c30d20d2bc8c55ac13405752 (patch)
treefac5cfe16bec8ae166e7d77fdfb8b0e0845af7f0
parent8c6d56f1f971d4804c6fe4618b2ead6aca7319a9 (diff)
Edin Kadribaic's bug report #408488 forced a rearrange of two struct fields
from urldata to connectdata, quite correctly.
-rw-r--r--lib/dict.c2
-rw-r--r--lib/http.c18
-rw-r--r--lib/telnet.c2
-rw-r--r--lib/url.c19
-rw-r--r--lib/urldata.h4
5 files changed, 26 insertions, 19 deletions
diff --git a/lib/dict.c b/lib/dict.c
index 893ef256e..53c245947 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -100,7 +100,7 @@ CURLcode Curl_dict(struct connectdata *conn)
char *path = conn->path;
long *bytecount = &conn->bytecount;
- if(data->bits.user_passwd) {
+ if(conn->bits.user_passwd) {
/* AUTH is missing */
}
diff --git a/lib/http.c b/lib/http.c
index 52b009d3e..a701e2a46 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -283,7 +283,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
"%s"
"\r\n",
hostname, remote_port,
- (data->bits.proxy_user_passwd)?conn->allocptr.proxyuserpwd:"",
+ (conn->bits.proxy_user_passwd)?conn->allocptr.proxyuserpwd:"",
(data->useragent?conn->allocptr.uagent:"")
);
@@ -340,7 +340,7 @@ CURLcode Curl_http_connect(struct connectdata *conn)
return CURLE_SSL_CONNECT_ERROR;
}
- if(data->bits.user_passwd && !data->bits.this_is_a_follow) {
+ if(conn->bits.user_passwd && !data->bits.this_is_a_follow) {
/* Authorization: is requested, this is not a followed location, get the
original host name */
data->auth_host = strdup(conn->hostname);
@@ -423,7 +423,7 @@ CURLcode Curl_http(struct connectdata *conn)
conn->allocptr.uagent=NULL;
}
- if((data->bits.user_passwd) && !checkheaders(data, "Authorization:")) {
+ if((conn->bits.user_passwd) && !checkheaders(data, "Authorization:")) {
char *authorization;
/* To prevent the user+password to get sent to other than the original
@@ -606,10 +606,14 @@ CURLcode Curl_http(struct connectdata *conn)
(data->bits.http_post || data->bits.http_formpost)?"POST":
(data->bits.http_put)?"PUT":"GET"),
ppath,
- (data->bits.proxy_user_passwd && conn->allocptr.proxyuserpwd)?conn->allocptr.proxyuserpwd:"",
- (data->bits.user_passwd && conn->allocptr.userpwd)?conn->allocptr.userpwd:"",
- (data->bits.set_range && conn->allocptr.rangeline)?conn->allocptr.rangeline:"",
- (data->useragent && *data->useragent && conn->allocptr.uagent)?conn->allocptr.uagent:"",
+ (conn->bits.proxy_user_passwd &&
+ conn->allocptr.proxyuserpwd)?conn->allocptr.proxyuserpwd:"",
+ (conn->bits.user_passwd && conn->allocptr.userpwd)?
+ conn->allocptr.userpwd:"",
+ (data->bits.set_range && conn->allocptr.rangeline)?
+ conn->allocptr.rangeline:"",
+ (data->useragent && *data->useragent && conn->allocptr.uagent)?
+ conn->allocptr.uagent:"",
(conn->allocptr.cookie?conn->allocptr.cookie:""), /* Cookie: <data> */
(conn->allocptr.host?conn->allocptr.host:""), /* Host: host */
http->p_pragma?http->p_pragma:"",
diff --git a/lib/telnet.c b/lib/telnet.c
index efcf5c638..c1b0601cc 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -745,7 +745,7 @@ static int check_telnet_options(struct connectdata *conn)
/* Add the user name as an environment variable if it
was given on the command line */
- if(data->bits.user_passwd)
+ if(conn->bits.user_passwd)
{
char *buf = malloc(256);
sprintf(buf, "USER,%s", data->user);
diff --git a/lib/url.c b/lib/url.c
index fc9b33e15..7d57bcb37 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -613,7 +613,6 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
* user:password to use in the operation
*/
data->userpwd = va_arg(param, char *);
- data->bits.user_passwd = data->userpwd?1:0;
break;
case CURLOPT_POSTQUOTE:
/*
@@ -657,7 +656,6 @@ CURLcode Curl_setopt(CURL *curl, CURLoption option, ...)
* user:password needed to use the proxy
*/
data->proxyuserpwd = va_arg(param, char *);
- data->bits.proxy_user_passwd = data->proxyuserpwd?1:0;
break;
case CURLOPT_RANGE:
/*
@@ -1288,10 +1286,15 @@ static CURLcode Connect(struct UrlData *data,
connections, so we set this to force-close. Protocols that support
this need to set this to FALSE in their "curl_do" functions. */
conn->bits.close = TRUE;
+
+ /* inherite initial knowledge from the data struct */
+ conn->bits.user_passwd = data->userpwd?1:0;
+ conn->bits.proxy_user_passwd = data->proxyuserpwd?1:0;
/* Store creation time to help future close decision making */
conn->created = Curl_tvnow();
+
/***********************************************************
* We need to allocate memory to store the path in. We get the size of the
* full URL to be sure, and we need to make it at least 256 bytes since
@@ -1406,7 +1409,7 @@ static CURLcode Connect(struct UrlData *data,
* Take care of user and password authentication stuff
*************************************************************/
- if(data->bits.user_passwd && !data->bits.use_netrc) {
+ if(conn->bits.user_passwd && !data->bits.use_netrc) {
data->user[0] =0;
data->passwd[0]=0;
@@ -1431,7 +1434,7 @@ static CURLcode Connect(struct UrlData *data,
/*************************************************************
* Take care of proxy authentication stuff
*************************************************************/
- if(data->bits.proxy_user_passwd) {
+ if(conn->bits.proxy_user_passwd) {
data->proxyuser[0] =0;
data->proxypasswd[0]=0;
@@ -1754,7 +1757,7 @@ static CURLcode Connect(struct UrlData *data,
conn->hostname);
}
else
- data->bits.user_passwd = 1; /* enable user+password */
+ conn->bits.user_passwd = 1; /* enable user+password */
/* weather we failed or not, we don't know which fields that were filled
in anyway */
@@ -1763,7 +1766,7 @@ static CURLcode Connect(struct UrlData *data,
if(!data->passwd[0])
strcpy(data->passwd, CURL_DEFAULT_PASSWORD);
}
- else if(!(data->bits.user_passwd) &&
+ else if(!(conn->bits.user_passwd) &&
(conn->protocol & (PROT_FTP|PROT_HTTP)) ) {
/* This is a FTP or HTTP URL, and we haven't got the user+password in
* the extra parameter, we will now try to extract the possible
@@ -1812,7 +1815,7 @@ static CURLcode Connect(struct UrlData *data,
}
conn->name = ++ptr;
- data->bits.user_passwd=1; /* enable user+password */
+ conn->bits.user_passwd=TRUE; /* enable user+password */
}
else {
strcpy(data->user, CURL_DEFAULT_USER);
@@ -1998,7 +2001,7 @@ static CURLcode Connect(struct UrlData *data,
/*************************************************************
* Proxy authentication
*************************************************************/
- if(data->bits.proxy_user_passwd) {
+ if(conn->bits.proxy_user_passwd) {
char *authorization;
snprintf(data->buffer, BUFSIZE, "%s:%s",
data->proxyuser, data->proxypasswd);
diff --git a/lib/urldata.h b/lib/urldata.h
index 53ff3427e..773d5bfae 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -183,6 +183,8 @@ struct ConnectBits {
bool reuse; /* if set, this is a re-used connection */
bool chunk; /* if set, this is a chunked transfer-encoding */
bool httpproxy; /* if set, this transfer is done through a http proxy */
+ bool user_passwd; /* do we use user+password for this connection? */
+ bool proxy_user_passwd; /* user+password for the proxy? */
};
/*
@@ -391,12 +393,10 @@ struct Configbits {
bool httpproxy;
bool mute;
bool no_body;
- bool proxy_user_passwd;
bool set_port;
bool set_range;
bool upload;
bool use_netrc;
- bool user_passwd;
bool verbose;
bool this_is_a_follow; /* this is a followed Location: request */
bool krb4; /* kerberos4 connection requested */