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

"http://" should be considered as a valid iri-reference #1070

Closed
marob opened this issue Jun 20, 2024 · 1 comment · Fixed by #1071
Closed

"http://" should be considered as a valid iri-reference #1070

marob opened this issue Jun 20, 2024 · 1 comment · Fixed by #1071

Comments

@marob
Copy link

marob commented Jun 20, 2024

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*(...).

@justin-tay
Copy link
Contributor

Thanks for the bug report. You are correct that "http://" is a valid iri reference.

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

Successfully merging a pull request may close this issue.

2 participants