Properly handling Gitlab URLs that contain ports.

Fixes #484, closes #501