diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-10-21 06:34:15 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-10-21 06:34:15 +0000 |
commit | d1c08e1d8526c200a300f3d20b49778aba3ff7dd (patch) | |
tree | f24193a45cb3d1fca4632b95dc6f4b5723c38d8f /lib | |
parent | d7c09efeb132340ef5e84a1acdc7f10e3cf2105d (diff) |
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.
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); } /************************************************************* |