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

Empty or null host when scheme is "file:"? #258

Closed
rmisev opened this issue Feb 23, 2017 · 5 comments
Closed

Empty or null host when scheme is "file:"? #258

rmisev opened this issue Feb 23, 2017 · 5 comments

Comments

@rmisev
Copy link
Member

rmisev commented Feb 23, 2017

In the "file host state" there are steps where host is set to the empty string, but in the "path state" at some step host is tested for null (and also set to null).

Because of this difference parser will report validation error for such valid URL:
file:///C:/path
In the "file host state" host is set to empty string, but in the "path state": "If url’s host is non-null, validation error."

So I think, host must be set to (and tested for) the same value in both cases; Maybe this value must be null?

@annevk
Copy link
Member

annevk commented Feb 23, 2017

Making it consistently the empty string would be best I think, though in theory it does not matter much for file URLs since they don't have the serialization difference.

@rmisev
Copy link
Member Author

rmisev commented Feb 23, 2017

I think by definition empty host is a valid opaque host string, used for non-special schemes. So I suggested the null. But maybe I am wrong?

@annevk
Copy link
Member

annevk commented Feb 23, 2017

@rmisev I mostly see it as empty meaning the URL starts with // after the scheme and null meaning the URL starts with a path. I guess we should update https://url.spec.whatwg.org/#scheme-relative-file-url-string to also allow the empty string.

@rmisev
Copy link
Member Author

rmisev commented Feb 24, 2017

It makes sense to use an empty string (also used in RFC 3986). But I don't think https://url.spec.whatwg.org/#scheme-relative-file-url-string must be changed, because second item allows empty host, i.e.:

must be "//", followed by ... a path-absolute-URL string.

I think must be changed URL's host definition https://url.spec.whatwg.org/#concept-host (or maybe https://url.spec.whatwg.org/#concept-url-host). Currently this definition allows empty host but only as opaque host, but opaque host is for non-special URLs (see note at https://url.spec.whatwg.org/#opaque-host). So changed definition:

  • A host is a domain, an IPv4 address, an IPv6 address, or an opaque host, or an empty host. Typically a host serves as a network address, but it is sometimes used as opaque identifier in URLs where a network address is not necessary.

A term empty host can be used for non-special and file URL's; then empty string (zero URL units) can be excluded from opaque host definition https://url.spec.whatwg.org/#valid-opaque-host-string - so opaque host means not empty.

What do you think about such changes?

@annevk
Copy link
Member

annevk commented Feb 24, 2017

That sounds reasonable.

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

No branches or pull requests

2 participants