aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorJim Fuller <jim@webcomposite.com>2018-11-01 19:16:15 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-09 15:47:28 +0100
commit5c4fe0d8264a4a4f591d79cefe9676b099bdecf2 (patch)
treed33052e3032909ef366f705e9876780aec64b72f /lib/url.c
parent073332b52515391338cff7bbe407d126fdf9c893 (diff)
setopt: add CURLOPT_CURLU
Allows an application to pass in a pre-parsed URL via a URL handle. Closes #3227
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/url.c b/lib/url.c
index dd9fa2617..6118177d6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2026,7 +2026,13 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
Curl_up_free(data); /* cleanup previous leftovers first */
/* parse the URL */
- uh = data->state.uh = curl_url();
+ if(data->set.uh) {
+ uh = data->set.uh;
+ }
+ else {
+ uh = data->state.uh = curl_url();
+ }
+
if(!uh)
return CURLE_OUT_OF_MEMORY;
@@ -2043,15 +2049,17 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
data->change.url_alloc = TRUE;
}
- uc = curl_url_set(uh, CURLUPART_URL, data->change.url,
+ if(!data->set.uh) {
+ uc = curl_url_set(uh, CURLUPART_URL, data->change.url,
CURLU_GUESS_SCHEME |
CURLU_NON_SUPPORT_SCHEME |
(data->set.disallow_username_in_url ?
CURLU_DISALLOW_USER : 0) |
(data->set.path_as_is ? CURLU_PATH_AS_IS : 0));
- if(uc) {
- DEBUGF(infof(data, "curl_url_set rejected %s\n", data->change.url));
- return Curl_uc_to_curlcode(uc);
+ if(uc) {
+ DEBUGF(infof(data, "curl_url_set rejected %s\n", data->change.url));
+ return Curl_uc_to_curlcode(uc);
+ }
}
uc = curl_url_get(uh, CURLUPART_SCHEME, &data->state.up.scheme, 0);
@@ -2193,6 +2201,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
return CURLE_OK;
}
+
/*
* If we're doing a resumed transfer, we need to setup our stuff
* properly.