mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
Edin Kadribaic's bug report #408488 forced a rearrange of two struct fields
from urldata to connectdata, quite correctly.
This commit is contained in:
parent
8c6d56f1f9
commit
f8e1fc32de
@ -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 */
|
||||
}
|
||||
|
||||
|
18
lib/http.c
18
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:"",
|
||||
|
@ -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);
|
||||
|
19
lib/url.c
19
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);
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user