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

Does not return ParseError for invalid Url #552

Open
Parth opened this issue Oct 10, 2019 · 4 comments
Open

Does not return ParseError for invalid Url #552

Parth opened this issue Oct 10, 2019 · 4 comments

Comments

@Parth
Copy link

Parth commented Oct 10, 2019

use url::Url;

fn main() {
    println!("{:?}", Url::parse("http://\""));
}

Outputs:

Ok("http://\"/")
@Parth
Copy link
Author

Parth commented Oct 10, 2019

Breaks Reqwests

@SimonSapin
Copy link
Member

I haven’t looked in details, but it may be that the set of strings that successfully parse as a URL in the URL Standard (which this crate implements, though it’s behind on some spec changes) is not the same as the set of strings that match the request-target grammar in HTTP RFCs (which http::Uri implements).

@timvisee
Copy link

Here are few other ones that parse successfully, but are likely invalid (via seanmonstar/reqwest#668 (comment)):

"http://‘nvme@nip2"
"http://-1@"
"https://a@b"
"https://€@qq"

@timvisee
Copy link

I discovered that Url currently accepts any character (except for a few blacklisted ones) as part of a hostname. I believe this might be the root cause of this issue.

Opened this issue for it: #554

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants