That's exactly what this does.

* protocol = "http:" then use protocol
* protocol = "https:" then use protocol
* protocol = "file:" then use "http:"