httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: httpd-2.0/modules/mappers mod_rewrite.c mod_rewrite.h
Date Wed, 29 May 2002 04:38:59 GMT
jwoolley    02/05/28 21:38:59

  Modified:    modules/mappers mod_rewrite.c mod_rewrite.h
  Log:
  Error out a bit more nicely if the RewriteMap prg: is not found.  We
  can't just apr_stat in the first init round because we haven't run
  apr_tokenize_to_argv() yet, and it would be a relatively ugly hack to run
  it twice just for that.  Well, I suppose we could store the argv in the
  rewritemap structure, but ... nah.  With this, we shutdown (cleanly, as
  opposed to the old exit(1) method) if we go to execute a rewritemap
  and discover it doesn't exist, and log a nice descriptive message at the
  end of the error_log.
  
  Revision  Changes    Path
  1.118     +14 -9     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.117
  retrieving revision 1.118
  diff -u -d -u -r1.117 -r1.118
  --- mod_rewrite.c	29 May 2002 03:27:01 -0000	1.117
  +++ mod_rewrite.c	29 May 2002 04:38:59 -0000	1.118
  @@ -987,8 +987,11 @@
        */
       for (; s; s = s->next) {
           open_rewritelog(s, p);
  -        if (!first_time)
  -           run_rewritemap_programs(s, p);
  +        if (!first_time) {
  +            if (run_rewritemap_programs(s, p) != APR_SUCCESS) {
  +                return HTTP_INTERNAL_SERVER_ERROR;
  +            }
  +        }
       }
       return OK;
   }
  @@ -3365,7 +3368,7 @@
   ** +-------------------------------------------------------+
   */
   
  -static void run_rewritemap_programs(server_rec *s, apr_pool_t *p)
  +static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p)
   {
       rewrite_server_conf *conf;
       apr_file_t *fpin = NULL;
  @@ -3383,7 +3386,7 @@
        *  don't even try to do anything.
        */
       if (conf->state == ENGINE_DISABLED) {
  -        return;
  +        return APR_SUCCESS;
       }
   
       rewritemaps = conf->rewritemaps;
  @@ -3405,15 +3408,15 @@
                                        &fpout, &fpin, &fperr);
           if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) {
               ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
  -                         "mod_rewrite: could not fork child for "
  -                         "RewriteMap process");
  -            exit(1);
  +                         "mod_rewrite: could not startup RewriteMap "
  +                         "program %s", map->datafile);
  +            return rc;
           }
           map->fpin  = fpin;
           map->fpout = fpout;
           map->fperr = fperr;
       }
  -    return;
  +    return APR_SUCCESS;
   }
   
   /* child process code */
  @@ -3424,11 +3427,13 @@
       apr_status_t rc;
       apr_procattr_t *procattr;
       apr_proc_t *procnew;
  +    apr_finfo_t st;
       char **argv;
   
       rc = apr_tokenize_to_argv(progname, &argv, p);
   
  -    if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) ||
  +    if (((rc = apr_stat(&st, argv[0], APR_FINFO_MIN, p)) != APR_SUCCESS) ||
  +        ((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) ||
  
  
  
  1.33      +1 -1      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.32
  retrieving revision 1.33
  diff -u -d -u -r1.32 -r1.33
  --- mod_rewrite.h	6 May 2002 18:24:03 -0000	1.32
  +++ mod_rewrite.h	29 May 2002 04:38:59 -0000	1.33
  @@ -455,7 +455,7 @@
   static apr_status_t rewritelock_remove(void *data);
   
       /* program map support */
  -static void  run_rewritemap_programs(server_rec *s, apr_pool_t *p);
  +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,
                                                apr_file_t **fpout, apr_file_t **fpin,
                                                apr_file_t **fperr);
  
  
  

Mime
View raw message