Generate URL prefixes with the right scheme

The main system identity's URL prefix, which is set during
installation and has no UI for configuration, used HTTP as the
scheme regardless of how the system was configured to be accessed
or the context (anonymous user or not) in which the URL would be
displayed.

Changed now so that the URL prefix is represented in the database
as a scheme to use for anonymous users, a scheme to use for
authenticated users (may be the same, of course,) and a hostname.