AP_DECLARE(void) ap_update_vhost_from_headers(request_rec *r)
{
    const char *host_header;

    if (r->hostname) {
        /*
         * If there was a host part in the Request-URI, ignore the 'Host'
         * header.
         */
        fix_hostname(r, NULL);
    }
    else if ((host_header = apr_table_get(r->headers_in, "Host")) != NULL ) {
        fix_hostname(r, host_header);
    }
    if (r->status != HTTP_OK)
        return;
    /* check if we tucked away a name_chain */
    if (r->connection->vhost_lookup_data) {
        if (r->hostname)
            check_hostalias(r);
        else
            check_serverpath(r);
    }
}