cnp3 / ebook

Third edition of the Computer Networking: Principles, Protocols and Practice ebook
https://www.computer-networking.info
112 stars 41 forks source link

BNF for URIs #123

Open Mathieu-COSYNS-Student opened 2 years ago

Mathieu-COSYNS-Student commented 2 years ago

In the Hypertext Transfer Protocol section, there is a subset of the BNF for URIs. It's a subset, it's not the full description of all URIs but I found it odd that the query and the fragment are included twice.

URI           = scheme ":" "//" authority path [ "?" query ] [ "#" fragment ]
scheme        = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
authority     = [ userinfo "@" ] host [ ":" port ]
query         = *( pchar / "/" / "?" )                                             <----------- HERE -----------
fragment      = *( pchar / "/" / "?" )                                             <----------- HERE -----------
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
query         = *( pchar / "/" / "?" )                                             <----------- HERE -----------
fragment      = *( pchar / "/" / "?" )                                             <----------- HERE -----------
pct-encoded   = "%" HEXDIG HEXDIG
unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved      = gen-delims / sub-delims
gen-delims    = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
obonaventure commented 2 years ago

Agreed, this is an error, feel free to propose an updated text

leonardomaccari commented 11 months ago

The error is still there, and there is another inconsistency, the URI scheme that is proposed requires "//", it is also mentioned in the text that The characters : and // follow the scheme of any URI. but then in the URN example in the footnote there is no "//": urn:isbn:0-380-81593-1