Better path handling

Since we already use the URI parser, let's use it to parse
the provided path as well.

As an added bonus, this means that queries and fragments are
handled in a sane manner, too.