On Install, which code sets the ‘home’ option?

When the installer runs it calls wp_install(), that in turn calls populate_options() defined in wp-admin/includes/schema.php, which runs the following..

if ( !__get_option('home') ) update_option('home', $guessurl);

Prior to that $guessurl is defined by..

$guessurl = wp_guess_url();

The guess URL function is defined in wp-includes/functions.php and looks like this.

function wp_guess_url() {
    if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
        $url = WP_SITEURL;
    } else {
        $schema = is_ssl() ? 'https://' : 'http://';
        $url = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    }
    return rtrim($url, "https://wordpress.stackexchange.com/");
}

Hope that’s the info you’re looking for… 🙂