From b3786f61dc53adba67dd489e404dc68a4b26575e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 3 Jul 2017 23:52:10 +0200 Subject: url: make the original string get used on subsequent transfers ... since CURLOPT_URL should follow the same rules as other options: they remain set until changed or cleared. Added test 1551 to verify. Fixes #1631 Closes #1632 Reported-by: Pavel Rochnyak --- lib/transfer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/transfer.c') diff --git a/lib/transfer.c b/lib/transfer.c index 43e8f64aa..81c056e0e 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1288,6 +1288,13 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) 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; + } + 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 after the *_setopt() calls (that could specify the size of the cache) but -- cgit v1.2.3