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

Avoid reparse issues with non-special URLs #459

Closed
wants to merge 1 commit into from

Conversation

zealousidealroll
Copy link

@zealousidealroll zealousidealroll commented Sep 6, 2018

This avoids a contradiction where the URL starts out with no host, but gets normalized into a URL where the first part of a path is interpreted as the host.

Fixes #397

This is a willfull violation of the URL specification for serialization. It retains spec-compliance for parsing, it aligns with the behavior of Microsoft Edge, and it "fixes" an acknowledged specification bug.

See whatwg/url#415


This change is Reviewable

@SimonSapin
Copy link
Member

Does this behavior match https://url.spec.whatwg.org/#url-parsing ?

This is a willfull violation of the URL specification for serialization.
It retains spec-compliance for parsing, it aligns with the behavior
of Microsoft Edge, and it "fixes" an acknowledged specification bug.

See whatwg/url#415

Fixes servo#397
@zealousidealroll
Copy link
Author

zealousidealroll commented Dec 11, 2018

I fixed it so that it complies with the specification for parsing. It wasn't compliant for parsing but it is now.

It still has to violate the spec for serialization, because rust-url's whole mode of operation assumes that URLs can be round-trip reparsed, and there's a bug in the spec that makes that not work. This change causes rust-url to behave the same way as Microsoft Edge (and I assume whatever C++-based parser it uses under the hood).

@zealousidealroll zealousidealroll changed the title Avoid parsing a path into // when there's no host Avoid reparse issues with non-special URLs Dec 11, 2018
@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #537) made this pull request unmergeable. Please resolve the merge conflicts.

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

Successfully merging this pull request may close these issues.

begin <= end (4 <= 2) when slicing a://a in Url::username
3 participants