Fix issues with trailing slashes and hg-history for HgWebClient.

The "hg-history" branch of the HgWeb implementation could strip off too much
stuff if people forgot to configure their server name with a trailing slash.
I've simplified the code and fixed the bug all in one go. Trivial change.

Testing done: Ran unit tests.

Fixes bug 3216.