Skip to content

CURLINFO_EFFECTIVE_URL doesn't add missing scheme #4491

@bagder

Description

@bagder

I did this

    curl_easy_setopt(curl, CURLOPT_URL, "example.com");
    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);
    /* Check for errors */
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

    if(!curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url) && url) {
      printf("We got this from %s\n", url);
    }

I expected the following output

We got this from http://example.com/

instead we get

We got this from example.com/

This behavior changed from after 7.61.1, which is the only older version I tested. I'm pretty sure the regression came in 7.62.0 when we modified the URL parser.

curl/libcurl version

current git master

operating system

all

Credits

Originally reported by @cderv Christophe Dervieux in: jeroen/curl#209

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions