url: fix PVS nits
- expression 'hostptr' is always true - a part of conditional expression is always true: proxypasswd - expression 'proxyuser' is always true - avoid multiple Curl_now() calls in allocate_conn Ref: #10929 Closes #10959
This commit is contained in:
parent
0ebf111b37
commit
21e7e44fb9
38
lib/url.c
38
lib/url.c
@ -1510,7 +1510,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
|
||||
conn->created = Curl_now();
|
||||
|
||||
/* Store current time to give a baseline to keepalive connection times. */
|
||||
conn->keepalive = Curl_now();
|
||||
conn->keepalive = conn->created;
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
conn->http_proxy.proxytype = data->set.proxytype;
|
||||
@ -1583,7 +1583,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
|
||||
it may live on without (this specific) Curl_easy */
|
||||
conn->fclosesocket = data->set.fclosesocket;
|
||||
conn->closesocket_client = data->set.closesocket_client;
|
||||
conn->lastused = Curl_now(); /* used now */
|
||||
conn->lastused = conn->created;
|
||||
conn->gssapi_delegation = data->set.gssapi_delegation;
|
||||
|
||||
return conn;
|
||||
@ -2328,22 +2328,17 @@ static CURLcode parse_proxy_auth(struct Curl_easy *data,
|
||||
data->state.aptr.proxyuser : "";
|
||||
const char *proxypasswd = data->state.aptr.proxypasswd ?
|
||||
data->state.aptr.proxypasswd : "";
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
if(proxyuser) {
|
||||
result = Curl_urldecode(proxyuser, 0, &conn->http_proxy.user, NULL,
|
||||
REJECT_ZERO);
|
||||
if(!result)
|
||||
result = Curl_setstropt(&data->state.aptr.proxyuser,
|
||||
conn->http_proxy.user);
|
||||
}
|
||||
if(!result && proxypasswd) {
|
||||
CURLcode result = Curl_urldecode(proxyuser, 0, &conn->http_proxy.user, NULL,
|
||||
REJECT_ZERO);
|
||||
if(!result)
|
||||
result = Curl_setstropt(&data->state.aptr.proxyuser,
|
||||
conn->http_proxy.user);
|
||||
if(!result)
|
||||
result = Curl_urldecode(proxypasswd, 0, &conn->http_proxy.passwd,
|
||||
NULL, REJECT_ZERO);
|
||||
if(!result)
|
||||
result = Curl_setstropt(&data->state.aptr.proxypasswd,
|
||||
conn->http_proxy.passwd);
|
||||
}
|
||||
if(!result)
|
||||
result = Curl_setstropt(&data->state.aptr.proxypasswd,
|
||||
conn->http_proxy.passwd);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -2899,12 +2894,11 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
|
||||
}
|
||||
|
||||
/* now, clone the cleaned host name */
|
||||
if(hostptr) {
|
||||
*hostname_result = strdup(hostptr);
|
||||
if(!*hostname_result) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
DEBUGASSERT(hostptr);
|
||||
*hostname_result = strdup(hostptr);
|
||||
if(!*hostname_result) {
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
goto error;
|
||||
}
|
||||
|
||||
*port_result = port;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user