Include port numbers when assembling URLs

Closes #275.