Closed marob closed 2 weeks ago
Because of this code, "http://" is considered as an invalid iri-reference.
Indeed, URI documentation tells it's following RFC 2396, and according to that RFC, it requires a non empty "authority" (if I understand well the BNC grammar):
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] absoluteURI = scheme ":" ( hier_part | opaque_part ) relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] hier_part = ( net_path | abs_path ) [ "?" query ] net_path = "//" authority [ abs_path ] authority = server | reg_name reg_name = 1*( unreserved | escaped | "$" | "," | ";" | ":" | "@" | "&" | "=" | "+" ) server = [ [ userinfo "@" ] hostport ] userinfo = *( unreserved | escaped | ";" | ":" | "&" | "=" | "+" | "$" | "," ) hostport = host [ ":" port ] host = hostname | IPv4address hostname = *( domainlabel "." ) toplabel [ "." ]
But, according to RFC 3987 that defines iri-reference, "http://" should be considered valid:
IRI-reference = IRI / irelative-ref IRI = scheme ":" ihier-part [ "?" iquery ] [ "#" ifragment ] ihier-part = "//" iauthority ipath-abempty / ipath-absolute / ipath-rootless / ipath-empty iauthority = [ iuserinfo "@" ] ihost [ ":" port ] ihost = IP-literal / IPv4address / ireg-name ireg-name = *( iunreserved / pct-encoded / sub-delims )
The difference is that ireg-name has a *(...) that allows to be empty while reg_name has a 1*(...).
ireg-name
*(...)
reg_name
1*(...)
Thanks for the bug report. You are correct that "http://" is a valid iri reference.
Because of this code, "http://" is considered as an invalid iri-reference.
Indeed, URI documentation tells it's following RFC 2396, and according to that RFC, it requires a non empty "authority" (if I understand well the BNC grammar):
But, according to RFC 3987 that defines iri-reference, "http://" should be considered valid:
The difference is that
ireg-name
has a*(...)
that allows to be empty whilereg_name
has a1*(...)
.