Fix assembleUrl() port dropping bug.

Also decided to make assembleUrl() public.