httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@locus.apache.org
Subject cvs commit: apache-1.3/src/modules/standard mod_rewrite.c mod_rewrite.h
Date Fri, 22 Sep 2000 20:47:21 GMT
fanf        00/09/22 13:47:21

  Modified:    src/modules/standard mod_rewrite.c mod_rewrite.h
  Log:
  replace more repeated code with function calls
  
  Revision  Changes    Path
  1.162     +19 -12    apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -u -u -r1.161 -r1.162
  --- mod_rewrite.c	2000/09/22 20:43:54	1.161
  +++ mod_rewrite.c	2000/09/22 20:47:19	1.162
  @@ -2124,12 +2124,7 @@
       }
       else if (strcmp(p->pattern, "-U") == 0) {
           /* avoid infinite subrequest recursion */
  -        if (strlen(input) > 0               /* nonempty path, and            */
  -            && (   r->main == NULL          /* - either not in a subrequest
 */
  -                || (   r->main->uri != NULL /* - or in a subrequest...       */
  -                    && r->uri != NULL       /*   ...and URIs aren't NULL...
 */
  -                                            /*   ...and sub/main URIs differ */
  -                    && strcmp(r->main->uri, r->uri) != 0) ) ) {
  +        if (strlen(input) > 0 && subreq_ok(r)) {
   
               /* run a URI-based subrequest */
               rsub = ap_sub_req_lookup_uri(input, r);
  @@ -2148,12 +2143,7 @@
       }
       else if (strcmp(p->pattern, "-F") == 0) {
           /* avoid infinite subrequest recursion */
  -        if (strlen(input) > 0               /* nonempty path, and            */
  -            && (   r->main == NULL          /* - either not in a subrequest
 */
  -                || (   r->main->uri != NULL /* - or in a subrequest...       */
  -                    && r->uri != NULL       /*   ...and URIs aren't NULL...
 */
  -                                            /*   ...and sub/main URIs differ */
  -                    && strcmp(r->main->uri, r->uri) != 0) ) ) {
  +        if (strlen(input) > 0 && subreq_ok(r)) {
   
               /* process a file-based subrequest:
                * this differs from -U in that no path translation is done.
  @@ -3999,6 +3989,23 @@
       }
   }
   
  +
  +/*
  +**
  +**  check that a subrequest won't cause infinite recursion
  +**
  +*/
  +
  +static int subreq_ok(request_rec *r)
  +{
  +    /*
  +     * either not in a subrequest, or in a subrequest
  +     * and URIs aren't NULL and sub/main URIs differ
  +     */
  +    return (r->main == NULL ||
  +	    (r->main->uri != NULL && r->uri != NULL &&
  +	     strcmp(r->main->uri, r->uri) != 0));
  +}
   
   
   /*
  
  
  
  1.71      +1 -0      apache-1.3/src/modules/standard/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -u -r1.70 -r1.71
  --- mod_rewrite.h	2000/09/22 20:43:55	1.70
  +++ mod_rewrite.h	2000/09/22 20:47:20	1.71
  @@ -487,6 +487,7 @@
   static int    parseargline(char *str, char **a1, char **a2, char **a3);
   static int    prefix_stat(const char *path, struct stat *sb);
   static void   add_env_variable(request_rec *r, char *s);
  +static int    subreq_ok(request_rec *r);
   
       /* File locking */
   static void fd_lock(request_rec *r, int fd);
  
  
  

Mime
View raw message