aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/transfer.c6
-rw-r--r--lib/url.c18
-rw-r--r--lib/url.h1
3 files changed, 12 insertions, 13 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index e6d98cfa4..c7f4ef9f3 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1516,13 +1516,11 @@ CURLcode Curl_follow(struct Curl_easy *data,
DEBUGASSERT(data->state.uh);
uc = curl_url_set(data->state.uh, CURLUPART_URL, newurl, 0);
if(uc)
- /* TODO: consider an error code remap here */
- return CURLE_URL_MALFORMAT;
+ return Curl_uc_to_curlcode(uc);
uc = curl_url_get(data->state.uh, CURLUPART_URL, &newurl, 0);
if(uc)
- /* TODO: consider an error code remap here */
- return CURLE_OUT_OF_MEMORY;
+ return Curl_uc_to_curlcode(uc);
if(type == FOLLOW_FAKE) {
/* we're only figuring out the new url if we would've followed locations
diff --git a/lib/url.c b/lib/url.c
index 0cc7d591a..723b89806 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1996,7 +1996,7 @@ static CURLcode findprotocol(struct Curl_easy *data,
}
-static CURLcode uc_to_curlcode(CURLUcode uc)
+CURLcode Curl_uc_to_curlcode(CURLUcode uc)
{
switch(uc) {
default:
@@ -2048,11 +2048,11 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
CURLU_DISALLOW_USER : 0) |
(data->set.path_as_is ? CURLU_PATH_AS_IS : 0));
if(uc)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
if(uc)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
result = findprotocol(data, conn, data->state.up.scheme);
if(result)
@@ -2067,7 +2067,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
conn->bits.user_passwd = TRUE;
}
else if(uc != CURLUE_NO_USER)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
uc = curl_url_get(uh, CURLUPART_PASSWORD, &data->state.up.password,
CURLU_URLDECODE);
@@ -2078,7 +2078,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
conn->bits.user_passwd = TRUE;
}
else if(uc != CURLUE_NO_PASSWORD)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
uc = curl_url_get(uh, CURLUPART_OPTIONS, &data->state.up.options,
CURLU_URLDECODE);
@@ -2088,7 +2088,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
return CURLE_OUT_OF_MEMORY;
}
else if(uc != CURLUE_NO_OPTIONS)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
uc = curl_url_get(uh, CURLUPART_HOST, &data->state.up.hostname, 0);
if(uc) {
@@ -2098,7 +2098,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
uc = curl_url_get(uh, CURLUPART_PATH, &data->state.up.path, 0);
if(uc)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
uc = curl_url_get(uh, CURLUPART_PORT, &data->state.up.port,
CURLU_DEFAULT_PORT);
@@ -3082,12 +3082,12 @@ static CURLcode override_login(struct Curl_easy *data,
if(user_changed) {
uc = curl_url_set(data->state.uh, CURLUPART_USER, *userp, 0);
if(uc)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
}
if(passwd_changed) {
uc = curl_url_set(data->state.uh, CURLUPART_PASSWORD, *passwdp, 0);
if(uc)
- return uc_to_curlcode(uc);
+ return Curl_uc_to_curlcode(uc);
}
return CURLE_OK;
}
diff --git a/lib/url.h b/lib/url.h
index 1c18f7137..095d63833 100644
--- a/lib/url.h
+++ b/lib/url.h
@@ -50,6 +50,7 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data);
void Curl_freeset(struct Curl_easy * data);
/* free the URL pieces */
void Curl_up_free(struct Curl_easy *data);
+CURLcode Curl_uc_to_curlcode(CURLUcode uc);
CURLcode Curl_close(struct Curl_easy *data); /* opposite of curl_open() */
CURLcode Curl_connect(struct Curl_easy *, struct connectdata **,
bool *async, bool *protocol_connect);