mirror of
https://github.com/curl/curl.git
synced 2025-09-23 20:46:48 +03:00
url.c: use 'CURLcode result'
This commit is contained in:
parent
0eb3d15ccb
commit
fb6e8a5aa4
28
lib/url.c
28
lib/url.c
|
@ -591,9 +591,8 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
|
||||||
|
|
||||||
CURLcode Curl_open(struct SessionHandle **curl)
|
CURLcode Curl_open(struct SessionHandle **curl)
|
||||||
{
|
{
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result;
|
||||||
struct SessionHandle *data;
|
struct SessionHandle *data;
|
||||||
CURLcode status;
|
|
||||||
|
|
||||||
/* Very simple start-up: alloc the struct, init it with zeroes and return */
|
/* Very simple start-up: alloc the struct, init it with zeroes and return */
|
||||||
data = calloc(1, sizeof(struct SessionHandle));
|
data = calloc(1, sizeof(struct SessionHandle));
|
||||||
|
@ -605,11 +604,11 @@ CURLcode Curl_open(struct SessionHandle **curl)
|
||||||
|
|
||||||
data->magic = CURLEASY_MAGIC_NUMBER;
|
data->magic = CURLEASY_MAGIC_NUMBER;
|
||||||
|
|
||||||
status = Curl_resolver_init(&data->state.resolver);
|
result = Curl_resolver_init(&data->state.resolver);
|
||||||
if(status) {
|
if(result) {
|
||||||
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
||||||
free(data);
|
free(data);
|
||||||
return status;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We do some initial setup here, all those fields that can't be just 0 */
|
/* We do some initial setup here, all those fields that can't be just 0 */
|
||||||
|
@ -4408,13 +4407,12 @@ static CURLcode parse_proxy(struct SessionHandle *data,
|
||||||
/* Is there a username and password given in this proxy url? */
|
/* Is there a username and password given in this proxy url? */
|
||||||
atsign = strchr(proxyptr, '@');
|
atsign = strchr(proxyptr, '@');
|
||||||
if(atsign) {
|
if(atsign) {
|
||||||
CURLcode res = CURLE_OK;
|
|
||||||
char *proxyuser = NULL;
|
char *proxyuser = NULL;
|
||||||
char *proxypasswd = NULL;
|
char *proxypasswd = NULL;
|
||||||
|
CURLcode result =
|
||||||
res = parse_login_details(proxyptr, atsign - proxyptr,
|
parse_login_details(proxyptr, atsign - proxyptr,
|
||||||
&proxyuser, &proxypasswd, NULL);
|
&proxyuser, &proxypasswd, NULL);
|
||||||
if(!res) {
|
if(!result) {
|
||||||
/* found user and password, rip them out. note that we are
|
/* found user and password, rip them out. note that we are
|
||||||
unescaping them, as there is otherwise no way to have a
|
unescaping them, as there is otherwise no way to have a
|
||||||
username or password with reserved characters like ':' in
|
username or password with reserved characters like ':' in
|
||||||
|
@ -4426,7 +4424,7 @@ static CURLcode parse_proxy(struct SessionHandle *data,
|
||||||
conn->proxyuser = strdup("");
|
conn->proxyuser = strdup("");
|
||||||
|
|
||||||
if(!conn->proxyuser)
|
if(!conn->proxyuser)
|
||||||
res = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
else {
|
else {
|
||||||
Curl_safefree(conn->proxypasswd);
|
Curl_safefree(conn->proxypasswd);
|
||||||
if(proxypasswd && strlen(proxypasswd) < MAX_CURL_PASSWORD_LENGTH)
|
if(proxypasswd && strlen(proxypasswd) < MAX_CURL_PASSWORD_LENGTH)
|
||||||
|
@ -4435,10 +4433,10 @@ static CURLcode parse_proxy(struct SessionHandle *data,
|
||||||
conn->proxypasswd = strdup("");
|
conn->proxypasswd = strdup("");
|
||||||
|
|
||||||
if(!conn->proxypasswd)
|
if(!conn->proxypasswd)
|
||||||
res = CURLE_OUT_OF_MEMORY;
|
result = CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!res) {
|
if(!result) {
|
||||||
conn->bits.proxy_user_passwd = TRUE; /* enable it */
|
conn->bits.proxy_user_passwd = TRUE; /* enable it */
|
||||||
atsign++; /* the right side of the @-letter */
|
atsign++; /* the right side of the @-letter */
|
||||||
|
|
||||||
|
@ -4449,8 +4447,8 @@ static CURLcode parse_proxy(struct SessionHandle *data,
|
||||||
Curl_safefree(proxyuser);
|
Curl_safefree(proxyuser);
|
||||||
Curl_safefree(proxypasswd);
|
Curl_safefree(proxypasswd);
|
||||||
|
|
||||||
if(res)
|
if(result)
|
||||||
return res;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start scanning for port number at this point */
|
/* start scanning for port number at this point */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user