You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jw...@apache.org on 2002/08/21 19:49:18 UTC

cvs commit: httpd-2.0/modules/mappers mod_rewrite.c mod_rewrite.h

jwoolley    2002/08/21 10:49:18

  Modified:    .        CHANGES
               modules/mappers mod_rewrite.c mod_rewrite.h
  Log:
  Fix a problem whereby RewriteMap prg:'s would get out of sync due to
  the inappropriate use of nonblocking reads.  Also get rid of the stderr
  altogether since mod_rewrite never uses it.
  
  PR: 9534
  
  Revision  Changes    Path
  1.893     +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.892
  retrieving revision 1.893
  diff -u -d -u -r1.892 -r1.893
  --- CHANGES	21 Aug 2002 16:42:53 -0000	1.892
  +++ CHANGES	21 Aug 2002 17:49:18 -0000	1.893
  @@ -1,4 +1,9 @@
   Changes with Apache 2.0.41
  +
  +  *) Fixed mod_rewrite's RewriteMap prg: support so that request/response
  +     pairs will no longer get out of sync with each other.  PR 9534
  +     [Cliff Woolley]
  +
     *) Fixes required to get quoted and escaped command args working in
        mod_ext_filter. PR 11793 [Paul J. Reder]
   
  
  
  
  1.125     +9 -18     httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.124
  retrieving revision 1.125
  diff -u -d -u -r1.124 -r1.125
  --- mod_rewrite.c	10 Jul 2002 06:01:10 -0000	1.124
  +++ mod_rewrite.c	21 Aug 2002 17:49:18 -0000	1.125
  @@ -3405,12 +3405,8 @@
   static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p)
   {
       rewrite_server_conf *conf;
  -    apr_file_t *fpin = NULL;
  -    apr_file_t *fpout = NULL;
  -    apr_file_t *fperr = NULL;
       apr_array_header_t *rewritemaps;
       rewritemap_entry *entries;
  -    rewritemap_entry *map;
       int i;
       apr_status_t rc;
   
  @@ -3426,7 +3422,10 @@
       rewritemaps = conf->rewritemaps;
       entries = (rewritemap_entry *)rewritemaps->elts;
       for (i = 0; i < rewritemaps->nelts; i++) {
  -        map = &entries[i];
  +        apr_file_t *fpin = NULL;
  +        apr_file_t *fpout = NULL;
  +        rewritemap_entry *map = &entries[i];
  +
           if (map->type != MAPTYPE_PRG) {
               continue;
           }
  @@ -3436,10 +3435,8 @@
               || map->fpout != NULL        ) {
               continue;
           }
  -        fpin  = NULL;
  -        fpout = NULL;
           rc = rewritemap_program_child(p, map->argv[0], map->argv,
  -                                     &fpout, &fpin, &fperr);
  +                                      &fpout, &fpin);
           if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) {
               ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
                            "mod_rewrite: could not startup RewriteMap "
  @@ -3448,7 +3445,6 @@
           }
           map->fpin  = fpin;
           map->fpout = fpout;
  -        map->fperr = fperr;
       }
       return APR_SUCCESS;
   }
  @@ -3456,17 +3452,16 @@
   /* child process code */
   static apr_status_t rewritemap_program_child(apr_pool_t *p, 
                                                const char *progname, char **argv,
  -                                             apr_file_t **fpout, apr_file_t **fpin,
  -                                             apr_file_t **fperr)
  +                                             apr_file_t **fpout,
  +                                             apr_file_t **fpin)
   {
       apr_status_t rc;
       apr_procattr_t *procattr;
       apr_proc_t *procnew;
   
       if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) ||
  -        ((rc = apr_procattr_io_set(procattr, APR_FULL_BLOCK,
  -                                  APR_FULL_NONBLOCK,
  -                                  APR_FULL_NONBLOCK)) != APR_SUCCESS) ||
  +        ((rc = apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_FULL_BLOCK,
  +                                   APR_NO_PIPE)) != APR_SUCCESS) ||
           ((rc = apr_procattr_dir_set(procattr, 
                                      ap_make_dirstr_parent(p, argv[0])))
            != APR_SUCCESS) ||
  @@ -3487,10 +3482,6 @@
   
               if (fpout) {
                   (*fpout) = procnew->out;
  -            }
  -
  -            if (fperr) {
  -                (*fperr) = procnew->err;
               }
           }
       }
  
  
  
  1.36      +2 -2      httpd-2.0/modules/mappers/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -d -u -r1.35 -r1.36
  --- mod_rewrite.h	22 Jun 2002 03:36:57 -0000	1.35
  +++ mod_rewrite.h	21 Aug 2002 17:49:18 -0000	1.36
  @@ -467,8 +467,8 @@
   static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p);
   static apr_status_t rewritemap_program_child(apr_pool_t *p, 
                                                const char *progname, char **argv,
  -                                             apr_file_t **fpout, apr_file_t **fpin,
  -                                             apr_file_t **fperr);
  +                                             apr_file_t **fpout,
  +                                             apr_file_t **fpin);
   
       /* env variable support */
   static char *lookup_variable(request_rec *r, char *var);