-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect overwrites CURLOPT_URL
option value when CURLOPT_FOLLOWLOCATION
used.
#1631
Comments
The
The But in At the https://curl.haxx.se/libcurl/c/curl_easy_perform.html page there is the following note:
But it is unclear if it is general requirement or only related to 'more than one file transfer', which requires to change file URL. |
This is definitely a bug, still present in 7.54.1... Setting the URL in the handle should make it remain set like that for subsequent transfers done on the same handle. |
... 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 Reported-by: Pavel Rochnyak
My proposed fix for this bug and test case to verify it, are in #1632 |
Hi.
In Collectd project (http://collectd.org, https://github.com/collectd/collectd/) there are several plugins which uses libcurl.
Libcurl is used by the following scheme:
curl_easy_init()
andcurl_easy_setopt()
.curl_easy_perform()
on the same libcurl object many times.The code uses
CURLOPT_FOLLOWLOCATION
option set to 1 at initialization.The
CURLOPT_URL
option set at the same time (at initialization).After some request was finished by redirect, subsequent requests are done to new location, not to location set by
CURLOPT_URL
.That is unexpected and undocumented behaviour.
It is expected that subsequent calls to
curl_easy_perform()
will be done with same options set, and to the location, set byCURLOPT_URL
.IMHO, something required to be changed - code or documentation.
What do you think?
curl/libcurl version
7.38.0 (yes, it is quite old, but I found no issue-related changes in current 7.54.1 version too)
operating system
Debian jessie
Related Collectd issue: collectd/collectd#2328
The text was updated successfully, but these errors were encountered: