Skip to content
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

CURLINFO_EFFECTIVE_URL doesn't add missing scheme #4491

Closed
bagder opened this issue Oct 15, 2019 · 1 comment

Comments

@bagder
Copy link
Member

@bagder bagder commented Oct 15, 2019

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

@bagder

This comment has been minimized.

Copy link
Member Author

@bagder bagder commented Oct 15, 2019

A complete stand-alone repro example: effective-url.c

bagder added a commit that referenced this issue Oct 16, 2019
The URL extracted with CURLINFO_EFFECTIVE_URL was returned as given as
input in most cases, which made it not get a scheme prefixed like before
if the URL was given without one, and it didn't remove dotdot sequences
etc.

Added test case 1907 to verify that this now works as intended and as
before 7.62.0.

Regression introduced in 7.62.0

Reported-by: Christophe Dervieux
Fixes #4491
@bagder bagder closed this in e062043 Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.