haskell / network-uri

URI manipulation facilities
Other
24 stars 33 forks source link

parseURI does not treat brackets properly #45

Closed damhiya closed 4 years ago

damhiya commented 4 years ago

Hi. I found parseURI returns Nothing when input string contains '[' or ']'. Since isAllowedInURI returns True for '[' and ']', parseURI should not be fail for uri that contains bracket character.

ezrakilty commented 4 years ago

Can you give an example? The square brackets are not allowed in most places in a URI. They are allowed as part of IPv6 addresses in the host part, and that seems to be the only place they're allowed:

A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where square bracket characters are allowed in the URI syntax.

https://tools.ietf.org/html/rfc3986#section-3.2.2

damhiya commented 4 years ago

Sorry, I don't have precise information about this (so I misunderstood the function) What I expected from escapeURIString was that It will escape registered characters appropriately for any input.

I read your comment and It seems solved

https://github.com/haskell/network-uri/blob/635efafdf60f2f02413dd70036ad65645c481cc3/Network/URI.hs#L98-L105