4 ms·
There are … a few errors in the post? > Scheme: (always present, not always visible) Schemes are required by the URI/URL's grammar. I'm not entirely sure what
by deathanatos 3y ago
There are … a few errors in the post?
> Scheme: (always present, not always visible)
Schemes are required by the URI/URL's grammar. I'm not entirely sure what "always present, not always visible" even means … those would seem to be synonyms. Perhaps we could infer "not always visible" to mean that there's some implied default … but there's not, not for a URI/URL. (For a relative-ref, yes.)
> Path: (always present)
… but this blows our implied default theory above out of the water. Paths are not always present: "https://google.com https://google.com" is a valid URL, with no path. (One could say it implies "/", but … see the above.)
> It is recommended to place IPv4 and IPv6 addresses into brackets:
It is definitely not "recommended" … it's malformed to put IPv4 addresses in brackets, and it's mandatory for IPv6 addresses.
Just read the RFC? https://datatracker.ietf.org/doc/html/rfc3986 https://datatracker.ietf.org/doc/html/rfc3986
> Host: (always present, not always visible)
I'm trying to think of how you could have a URL without a host "visible". The network location is like the defining feature of a URL, vs. a URI.
But if a URI lacks a host, it's not just "not visible", again, there's no implied default there. "Host" might not even make sense, depending on the scheme.
- tkot 3y ago> Host: (always present, not always visible) Hostname can be skipped in file URI and localhost will be assumed, maybe that's what the author meant.
- deathanatos 3y agoHo! You're right, that is a corner case. It has the netloc's starting sigil ("//") but there's nothing prior the path. I was just uncertain enough on that one that I didn't want to say it never happens, and I'm kinda glad I didn't.
- johnny22 3y agomaybe it just meant that the scheme isn't visible in the address bar in a browser like chrome.
- whatbackup 3y agoAuthor here; you are right! - Added more context. Thank you
- deathanatos 3y agoAh, … interesting. Firefox doesn't do such silliness.
- whatbackup 3y agoHello, author here: thank you for your feedback! In general, I've removed the notes in the brackets and either added more context and examples or integrated it into the text. > Scheme: (always present, not always visible) Added more context. > Path: (always present) You are right, the root directory `/` is implied. Added this as an example. > It is recommended to place IPv4 and IPv6 addresses into brackets: Correct, my bad. I've added more examples and the note, that it is required to put IPv6 addresses into square brackets. > Host: (always present, not always visible) Been a while so I am not sure what I meant. I've made some changes and added more examples. Again, thank you!