conn->user and conn->passwd will now always be set to point to something.
If not user or password is set, they will point to a "" string.
This commit is contained in:
parent
d7c09efeb1
commit
d1c08e1d85
@ -125,9 +125,7 @@ static CURLcode Curl_output_basic(struct connectdata *conn)
|
|||||||
char *authorization;
|
char *authorization;
|
||||||
struct SessionHandle *data=conn->data;
|
struct SessionHandle *data=conn->data;
|
||||||
|
|
||||||
sprintf(data->state.buffer, "%s:%s",
|
sprintf(data->state.buffer, "%s:%s", conn->user, conn->passwd);
|
||||||
conn->user?conn->user:"",
|
|
||||||
conn->passwd?conn->passwd:"");
|
|
||||||
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer),
|
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer),
|
||||||
&authorization) >= 0) {
|
&authorization) >= 0) {
|
||||||
if(conn->allocptr.userpwd)
|
if(conn->allocptr.userpwd)
|
||||||
@ -147,8 +145,7 @@ static CURLcode Curl_output_basic_proxy(struct connectdata *conn)
|
|||||||
struct SessionHandle *data=conn->data;
|
struct SessionHandle *data=conn->data;
|
||||||
|
|
||||||
sprintf(data->state.buffer, "%s:%s",
|
sprintf(data->state.buffer, "%s:%s",
|
||||||
conn->proxyuser?conn->proxyuser:"",
|
conn->proxyuser, conn->proxypasswd);
|
||||||
conn->proxypasswd?conn->proxypasswd:"");
|
|
||||||
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer),
|
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer),
|
||||||
&authorization) >= 0) {
|
&authorization) >= 0) {
|
||||||
Curl_safefree(conn->allocptr.proxyuserpwd);
|
Curl_safefree(conn->allocptr.proxyuserpwd);
|
||||||
@ -291,7 +288,7 @@ CURLcode http_auth_headers(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
if(auth)
|
if(auth)
|
||||||
infof(data, "Server auth using %s with user '%s'\n",
|
infof(data, "Server auth using %s with user '%s'\n",
|
||||||
auth, conn->user?conn->user:"");
|
auth, conn->user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2765,9 +2765,9 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
/* This is the default password, so DON'T set conn->bits.user_passwd */
|
/* This is the default password, so DON'T set conn->bits.user_passwd */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* store user + password */
|
/* store user + password, zero-length if not set */
|
||||||
conn->user = user[0]?strdup(user):NULL;
|
conn->user = strdup(user);
|
||||||
conn->passwd = passwd[0]?strdup(passwd):NULL;
|
conn->passwd = strdup(passwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
|
Loading…
x
Reference in New Issue
Block a user