from urldata to connectdata, quite correctly.
char *path = conn->path;
long *bytecount = &conn->bytecount;
- if(data->bits.user_passwd) {
+ if(conn->bits.user_passwd) {
/* AUTH is missing */
}
"%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:"")
);
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);
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
(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:"",
/* 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);
* 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:
/*
* 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:
/*
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
* 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;
/*************************************************************
* 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;
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 */
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
}
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);
/*************************************************************
* 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);
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? */
};
/*
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 */