Support for protocol-relative URL generation, closes #1224