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
This commit is contained in:
Daniel Stenberg 2017-07-03 23:52:10 +02:00
parent c0cdc68c7e
commit b3786f61dc
5 changed files with 129 additions and 2 deletions

View file

@ -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