Separated the URL parsing.

This is intrinsically linked to the route parsing, but it shouldn't
really be in the same place.
More testing for the route modules.

These functions need small integration tests just to verify their
behaviour.