httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_alias.c
Date Mon, 14 Jun 2004 22:09:42 GMT
nd          2004/06/14 15:09:42

  Modified:    .        Tag: APACHE_2_0_BRANCH CHANGES STATUS
               modules/mappers Tag: APACHE_2_0_BRANCH mod_alias.c
  Log:
  Emit a warning if an alias overlaps another.
  
  Reviewed by: Brad Nicholes, Jean-Jacques Clar
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.988.2.304 +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.303
  retrieving revision 1.988.2.304
  diff -u -u -r1.988.2.303 -r1.988.2.304
  --- CHANGES	11 Jun 2004 21:05:20 -0000	1.988.2.303
  +++ CHANGES	14 Jun 2004 22:09:40 -0000	1.988.2.304
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.50
   
  +  *) mod_alias now emits a warning if it detects overlapping *Alias*
  +     directives.  [André Malo]
  +
     *) mod_rewrite no longer turns forward proxy requests into reverse proxy
        requests. PR 28125  [ast domdv.de, André Malo]
   
  
  
  
  1.751.2.925 +1 -5      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.924
  retrieving revision 1.751.2.925
  diff -u -u -r1.751.2.924 -r1.751.2.925
  --- STATUS	14 Jun 2004 17:48:10 -0000	1.751.2.924
  +++ STATUS	14 Jun 2004 22:09:41 -0000	1.751.2.925
  @@ -180,10 +180,6 @@
             modules/filters/mod_include.c: r1.296
          +1: nd
   
  -    *) mod_alias: Emit a warning if an alias overlaps another
  -          modules/mappers/mod_alias.c: r1.45, 1.46, 1.47, 1.48, 1.55
  -      +1: nd, bnicholes, jjclar
  -
       *) Fixed mean and median calculations in ab, also changed where time values
          are set for start and connect when doing keep alive benchmarking.
              support/ab.c: r1.143
  
  
  
  No                   revision
  No                   revision
  1.43.2.7  +28 -0     httpd-2.0/modules/mappers/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_alias.c,v
  retrieving revision 1.43.2.6
  retrieving revision 1.43.2.7
  diff -u -u -r1.43.2.6 -r1.43.2.7
  --- mod_alias.c	9 Feb 2004 20:53:18 -0000	1.43.2.6
  +++ mod_alias.c	14 Jun 2004 22:09:42 -0000	1.43.2.7
  @@ -94,6 +94,9 @@
       return a;
   }
   
  +/* need prototype for overlap check */
  +static int alias_matches(const char *uri, const char *alias_fakename);
  +
   static const char *add_alias_internal(cmd_parms *cmd, void *dummy,
                                         const char *f, const char *r,
                                         int use_regex)
  @@ -102,6 +105,8 @@
       alias_server_conf *conf = ap_get_module_config(s->module_config,
                                                      &alias_module);
       alias_entry *new = apr_array_push(conf->aliases);
  +    alias_entry *entries = (alias_entry *)conf->aliases->elts;
  +    int i;
   
       /* XX r can NOT be relative to DocumentRoot here... compat bug. */
   
  @@ -121,6 +126,29 @@
       }
       new->fake = f;
       new->handler = cmd->info;
  +
  +    /* check for overlapping (Script)Alias directives
  +     * and throw a warning if found one
  +     */
  +    if (!use_regex) {
  +        for (i = 0; i < conf->aliases->nelts - 1; ++i) {
  +            alias_entry *p = &entries[i];
  +
  +            if (  (!p->regexp &&  alias_matches(f, p->fake) > 0)
  +                || (p->regexp && !ap_regexec(p->regexp, f, 0, NULL, 0)))
{
  +                ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server,
  +                             "The %s directive in %s at line %d will probably "
  +                             "never match because it overlaps an earlier "
  +                             "%sAlias%s.",
  +                             cmd->cmd->name, cmd->directive->filename,
  +                             cmd->directive->line_num,
  +                             p->handler ? "Script" : "",
  +                             p->regexp ? "Match" : "");
  +
  +                break; /* one warning per alias should be sufficient */
  +            }
  +        }
  +    }
   
       return NULL;
   }
  
  
  

Mime
View raw message