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

(-)file_not_specified_in_diff (-15 / +60 lines)
Lines 1-6 Link Here
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
1
/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
2
 * contributor license agreements.  See the NOTICE file distributed with
2
 * applicable.
3
 * this work for additional information regarding copyright ownership.
3
 *
4
 * The ASF licenses this file to You under the Apache License, Version 2.0
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * (the "License"); you may not use this file except in compliance with
5
 * you may not use this file except in compliance with the License.
6
 * the License.  You may obtain a copy of the License at
6
 * You may obtain a copy of the License at
7
--
Line 52 Link Here
52
Line 62 Link Here
61
62
typedef enum {
63
    STRIPWWW_ON, STRIPWWW_OFF
64
} mva_stripwww_e;
65
Line 70 Link Here
74
    mva_stripwww_e stripwww;  
Line 72 Link Here
77
Line 75 Link Here
75
Line 81 Link Here
86
    conf->stripwww = STRIPWWW_OFF;
Line 107 Link Here
113
    if (child->stripwww == STRIPWWW_OFF) {
114
        conf->stripwww = parent->stripwww;
115
    }
116
    else {
117
        conf->stripwww = child->stripwww;
118
    }
Line 120 Link Here
132
133
static const char *cmd_stripwww (cmd_parms *cmd, void *dummy, int flag)
134
{
135
    mva_sconf_t *conf;
136
    conf = (mva_sconf_t *) ap_get_module_config(cmd->server->module_config, 
137
                                                &vhost_alias_module);
138
    conf->stripwww = (flag ? STRIPWWW_ON : STRIPWWW_OFF);
139
    return NULL;
140
}
141
Line 229 Link Here
251
    AP_INIT_FLAG("VirtualStripWWW", cmd_stripwww, NULL, OR_FILEINFO,
252
                  "flag to strip any www. prefix from host"),
Line 386 Link Here
386
    const char *name, *map, *uri;
410
    const char *map, *uri;
387
--
Line 389 Link Here
413
    char *name_stripped, *name_current;
414
    const char *strip_prefix = "www.";
415
    char *name;
Line 412 Link Here
412
439
    
413
--
Line 414 Link Here
414
        name = ap_get_server_name(r);
441
        /* try to get the host from r->hostname rather than server, or 
415
--
442
           ap_get so that you get what was passed via mod_proxy_http */
443
        if (r->hostname != NULL){
444
            name_stripped = (char*)r->hostname;
445
            name_current = (char*)ap_get_server_name(r);
446
        }
447
        else {
448
            name_stripped = (char*)ap_get_server_name(r);
449
            name_current = (char*)r->server->server_hostname;
450
        }
451
452
        /* if the host does not match the servername & stripwww is set &
453
           the www. prefix is present, then strip the www */
454
        if (
455
                (strcmp(name_stripped, name_current) != 0 && 
456
                    memcmp(name_stripped, strip_prefix,4) == 0) ||
457
                (conf->stripwww == STRIPWWW_ON && 
458
                    memcmp(name_stripped, strip_prefix,4) == 0)
459
                ){
460
                name_stripped += 4;
461
        }
462
        
463
        name = name_stripped;

Return to bug 40441