Take a look at 78c0ff6.

It gets rid of a bunch of duplicated code for creating URLs and reduces the number of times that `config.uri_scheme` or `https://` is referenced.