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

URL parser: userinfo breaks the protocol guessing when no scheme is given #4856

Closed
bagder opened this issue Jan 27, 2020 · 0 comments
Closed

URL parser: userinfo breaks the protocol guessing when no scheme is given #4856

bagder opened this issue Jan 27, 2020 · 0 comments
Assignees
Labels
URL

Comments

@bagder
Copy link
Member

@bagder bagder commented Jan 27, 2020

I did this

curl user:password@ftp.funet.fi

I expected the following

That curl would try to use FTP to the site and use the given name and password for login. Instead it made a HTTP request to the given host.

The reason for this mistake is that the "protocol guessing" is done on the host name part when the credentials are still prepended! This does also make something like curl ftp.user:pwd@example.com (wrongly) guess on FTP based on the user name and not on the host name!

I have extended test 1560 with these two examples and will work on a PR.

curl/libcurl version

latest git

operating system

any

@bagder bagder added the URL label Jan 27, 2020
@bagder bagder self-assigned this Jan 27, 2020
bagder added a commit that referenced this issue Jan 27, 2020
In the "scheme-less" parsing case, we need to strip off credentials
first before we guess scheme based on the host name!

Fixes #4856
@bagder bagder closed this in d3dc0a0 Jan 28, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant
You can’t perform that action at this time.