-
Notifications
You must be signed in to change notification settings - Fork 139
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
Comments
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. |
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? |
@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. |
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.:
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 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? |
That sounds reasonable. |
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?
The text was updated successfully, but these errors were encountered: