diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http.c | 9 | ||||
-rw-r--r-- | lib/url.c | 6 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/http.c b/lib/http.c index bb09be10d..2f7db943b 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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); } /************************************************************* |