sshyran / genxdm

Automatically exported from code.google.com/p/genxdm
0 stars 0 forks source link

Add a utility that can reliably create a URI from a string, regardless of %-encoding issues #139

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
URI.create(String) and URI(String) both break if there's anything in the string 
that *should* be percent-encoded, but isn't.

URI(String, String, String) and URI(String, String, String, String, String), as 
well as the other less-likely constructors will break if the components *are* 
encoded (because it will %-encode any '%' character that it finds).

Just brilliant. The code that knows how to break a string into components won't 
create a URI if it isn't encoded, so you can't use it to break the string into 
components, which can then be safely passed to the multi-argument constructors.

Solution: use the regex from RFC3986 to break the string down, and then decode 
each component and hand them all to a multi-argument constructor. Replace calls 
to URI(String) or URI.create(String) with StringToURIParser.parse(String).

Original issue reported on code.google.com by aale...@gmail.com on 30 Aug 2013 at 7:18

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r468.

Original comment by aale...@gmail.com on 30 Aug 2013 at 7:35