Rewrite to use uri_parser:parse/2 and add unit tests.