Skip to content

Redirect overwrites CURLOPT_URL option value when CURLOPT_FOLLOWLOCATION used. #1631

@rpv-tomsk

Description

@rpv-tomsk

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:

  1. Libcurl object initialized and configured once, by calling curl_easy_init() and curl_easy_setopt().
  2. Requests will be done later by calling 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 by CURLOPT_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions