View | Details | Raw Unified | Return to bug 51709
Collapse All | Expand All

(-)server/vhost.c (-12 / +25 lines)
Lines 860-868 Link Here
860
    const char *host = r->hostname;
860
    const char *host = r->hostname;
861
    apr_port_t port;
861
    apr_port_t port;
862
    server_rec *s;
862
    server_rec *s;
863
    server_rec *virthost_s;
863
    server_rec *last_s;
864
    server_rec *last_s;
864
    name_chain *src;
865
    name_chain *src;
865
866
867
    virthost_s = NULL;
866
    last_s = NULL;
868
    last_s = NULL;
867
869
868
    port = r->connection->local_addr->port;
870
    port = r->connection->local_addr->port;
Lines 889-911 Link Here
889
891
890
        s = src->server;
892
        s = src->server;
891
893
892
        /* does it match the virthost from the sar? */
894
        /* If we still need to do ServerName and ServerAlias checks for this
893
        if (!strcasecmp(host, sar->virthost)) {
895
         * server, do them now.
894
            goto found;
896
         */
897
        if (s != last_s) {
898
            /* does it match any ServerName or ServerAlias directive? */
899
            if (matches_aliases(s, host)) {
900
                goto found;
901
            }
895
        }
902
        }
896
897
        if (s == last_s) {
898
            /* we've already done ServerName and ServerAlias checks for this
899
             * vhost
900
             */
901
            continue;
902
        }
903
        last_s = s;
903
        last_s = s;
904
904
905
        if (matches_aliases(s, host)) {
905
        /* Fallback: does it match the virthost from the sar? */
906
            goto found;
906
        if (!strcasecmp(host, sar->virthost)) {
907
            /* only the first match is used */
908
            if (virthost_s == NULL) {
909
                virthost_s = s;
910
            }
907
        }
911
        }
908
    }
912
    }
913
    
914
    /* If ServerName and ServerAlias check failed, we end up here.  If it
915
     * matches a VirtualHost, virthost_s is set. Use that as fallback
916
     */
917
    if (virthost_s) {
918
        s = virthost_s;
919
        goto found;
920
    }
921
909
    return;
922
    return;
910
923
911
found:
924
found:

Return to bug 51709