summaryrefslogtreecommitdiff
path: root/lib/transfer.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/transfer.c
parent073332b52515391338cff7bbe407d126fdf9c893 (diff)
downloadcurl-5c4fe0d8264a4a4f591d79cefe9676b099bdecf2.tar.gz
setopt: add CURLOPT_CURLU
Allows an application to pass in a pre-parsed URL via a URL handle. Closes #3227
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index de6043d7d..32ca5a496 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1353,17 +1353,30 @@ void Curl_init_CONNECT(struct Curl_easy *data)
CURLcode Curl_pretransfer(struct Curl_easy *data)
{
CURLcode result;
- if(!data->change.url) {
+
+ if(!data->change.url && !data->set.uh) {
/* we can't do anything without URL */
failf(data, "No URL set!");
return CURLE_URL_MALFORMAT;
}
+
/* since the URL may have been redirected in a previous use of this handle */
if(data->change.url_alloc) {
/* the already set URL is allocated, free it first! */
Curl_safefree(data->change.url);
data->change.url_alloc = FALSE;
}
+
+ if(!data->change.url && data->set.uh) {
+ CURLUcode uc;
+ uc = curl_url_get(data->set.uh,
+ CURLUPART_URL, &data->set.str[STRING_SET_URL], 0);
+ if(uc) {
+ failf(data, "No URL set!");
+ return CURLE_URL_MALFORMAT;
+ }
+ }
+
data->change.url = data->set.str[STRING_SET_URL];
/* Init the SSL session ID cache here. We do it here since we want to do it