uriparser / uriparser

:hocho: Strictly RFC 3986 compliant URI parsing and handling library written in C89; moved from SourceForge to GitHub

Home Page:https://uriparser.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scheme based normalization?

estobbart opened this issue · comments

Section 6.23. describes scheme based normalization..
https://datatracker.ietf.org/doc/html/rfc3986#section-6.2.3

Right now, it doesn't appear to apply this normalization.
I believe the expectation is that creating a URI of http://example.org, would return http://example.org/ from the ToString method.
Is that what this comment is referencing?
https://github.com/uriparser/uriparser/blob/master/src/UriRecompose.c#L423

Is this out of scope due to it referencing other RFC's?

@estobbart I'll do a quick reply without in-depth verification first, please treat as such:
I believe that section 6.2.3 is more about end users than about parsing: If uriparser would always normalize as such it would become hard to distinguish the two cases. uriparser could offer normalization like that as an additional feature but e.g. to normalize ports would not scale well since we'd need to hardcode and maintain a port mapping list and so on. The trailing slash part is a bit of a different story maybe but for now I'd probably want to ask applications do that normalization on top of uriparser themselves. What do you think?

Of course. It may be helpful to note that in the ToString method that normalization/6.2.3 is an application responsibility. Providing an optional normalization callback would help signal the intent as well.

@estobbart I have created a related pull request #174 now. Would you say that's good enough?