httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: apache-1.3/src/modules/standard mod_negotiation.c
Date Wed, 03 Oct 2001 22:35:19 GMT
stoddard    01/10/03 15:35:19

  Modified:    src/modules/standard mod_negotiation.c
  Log:
  Fix a mismatching issue, where index.html.foo.en had recognized .html and
  .en components, and exceptions index and foo.  This patch will ignore the
  'missing' exception html from the request, and go on to test the exception
  foo in the list.
  
  This does -not- imply that a request for index.foo will succeed, in the
  example above.  The pattern match tests index.foo[.*] so we wouldn't find
  index.html.foo.anything.  The pattern matching proposed at one time by
  Francis Daly would allow index.foo to succeed as well [although many to
  many matching is dangerous, see comments in this patch.]
  
  Port of patch from 2.0 by Bill Rowe
  
  Revision  Changes    Path
  1.109     +30 -15    apache-1.3/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.108
  retrieving revision 1.109
  diff -u -r1.108 -r1.109
  --- mod_negotiation.c	2001/10/02 21:01:31	1.108
  +++ mod_negotiation.c	2001/10/03 22:35:19	1.109
  @@ -972,26 +972,41 @@
               continue;
           }
   
  -        /*
  -         * Simple enough for now, every unreconized bit better match
  -         * our base name.  When we break up our base name and allow
  -         * index.en to match index.html.en, this gets tricker.
  -         * XXX: index.html.foo won't be caught by testing index.html
  -         * since the exceptions result is index.foo - this should be
  -         * fixed as part of a new match-parts logic here.
  +        /* Each unregonized bit better match our base name, in sequence.
  +         * A test of index.html.foo will match index.foo or index.html.foo,
  +         * but it will never transpose the segments and allow index.foo.html
  +         * because that would introduce too much CPU consumption.  Better that
  +         * we don't attempt a many-to-many match here.
            */
           {
  -            char *base = ap_array_pstrcat(sub_req->pool, exception_list, '.');
  -            int base_len = strlen(base);
  -            if (base_len > prefix_len 
  +            int nexcept = exception_list->nelts;
  +            char **cur_except = (char**)exception_list->elts;
  +            char *segstart = filp, *segend, saveend;
  +
  +            while (*segstart && nexcept) {
  +                if (!(segend = strchr(segstart, '.')))
  +                    segend = strchr(segstart, '\0');
  +                saveend = *segend;
  +                *segend = '\0';
  +
   #ifdef CASE_BLIND_FILESYSTEM
  -                || strncasecmp(base, filp, base_len)
  +                if (strcasecmp(segstart, *cur_except) == 0) {
   #else
  -                || strncmp(base, filp, base_len)
  +                if (strcmp(segstart, *cur_except) == 0) {
   #endif
  -                || (prefix_len > base_len && filp[base_len] != '.')) {
  -                /* 
  -                 * Something you don't know is, something you don't know...
  +                    --nexcept;
  +                    ++cur_except;
  +                }
  +
  +                if (!saveend)
  +                    break;
  +
  +                *segend = saveend;
  +                segstart = segend + 1;
  +            }
  +
  +            if (nexcept) {
  +                /* Something you don't know is, something you don't know...
                    */
                   ap_destroy_sub_req(sub_req);
                   continue;
  
  
  

Mime
View raw message