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;
|
||||
struct SessionHandle *data=conn->data;
|
||||
|
||||
sprintf(data->state.buffer, "%s:%s",
|
||||
conn->user?conn->user:"",
|
||||
conn->passwd?conn->passwd:"");
|
||||
sprintf(data->state.buffer, "%s:%s", conn->user, conn->passwd);
|
||||
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer),
|
||||
&authorization) >= 0) {
|
||||
if(conn->allocptr.userpwd)
|
||||
@ -147,8 +145,7 @@ static CURLcode Curl_output_basic_proxy(struct connectdata *conn)
|
||||
struct SessionHandle *data=conn->data;
|
||||
|
||||
sprintf(data->state.buffer, "%s:%s",
|
||||
conn->proxyuser?conn->proxyuser:"",
|
||||
conn->proxypasswd?conn->proxypasswd:"");
|
||||
conn->proxyuser, conn->proxypasswd);
|
||||
if(Curl_base64_encode(data->state.buffer, strlen(data->state.buffer),
|
||||
&authorization) >= 0) {
|
||||
Curl_safefree(conn->allocptr.proxyuserpwd);
|
||||
@ -291,7 +288,7 @@ CURLcode http_auth_headers(struct connectdata *conn,
|
||||
}
|
||||
if(auth)
|
||||
infof(data, "Server auth using %s with user '%s'\n",
|
||||
auth, conn->user?conn->user:"");
|
||||
auth, conn->user);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2765,9 +2765,9 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
/* This is the default password, so DON'T set conn->bits.user_passwd */
|
||||
}
|
||||
else {
|
||||
/* store user + password */
|
||||
conn->user = user[0]?strdup(user):NULL;
|
||||
conn->passwd = passwd[0]?strdup(passwd):NULL;
|
||||
/* store user + password, zero-length if not set */
|
||||
conn->user = strdup(user);
|
||||
conn->passwd = strdup(passwd);
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user