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_rewrite.c mod_rewrite.h
Date Thu, 31 Jul 2003 23:43:37 GMT
nd          2003/07/31 16:43:37

  Modified:    .        Tag: APACHE_2_0_BRANCH STATUS
               modules/mappers Tag: APACHE_2_0_BRANCH mod_rewrite.c
                        mod_rewrite.h
  Log:
  exit(1) should never occur in any module. Stay away from it.
  
  Reviewed by: Jeff Trawick, Bill Stoddard
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.751.2.408 +0 -5      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.407
  retrieving revision 1.751.2.408
  diff -u -r1.751.2.407 -r1.751.2.408
  --- STATUS	31 Jul 2003 23:15:12 -0000	1.751.2.407
  +++ STATUS	31 Jul 2003 23:43:36 -0000	1.751.2.408
  @@ -278,11 +278,6 @@
           modules/mappers/mod_rewrite.c: r1.162
         +1: nd, trawick (?)
   
  -    * mod_rewrite: don't exit(1) if the logfile could not be opened. Return
  -      internal server error instead to shutdown cleanly.
  -        modules/mappers/mod_rewrite.c: r1.191
  -      +1: nd, trawick, stoddard
  -
       * Install config.nice to make minor version upgrades easier.
           Makefile.in: r1.136
         +1: slive, trawick, erikabele
  
  
  
  No                   revision
  No                   revision
  1.135.2.15 +16 -14    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.135.2.14
  retrieving revision 1.135.2.15
  diff -u -r1.135.2.14 -r1.135.2.15
  --- mod_rewrite.c	31 Jul 2003 22:58:58 -0000	1.135.2.14
  +++ mod_rewrite.c	31 Jul 2003 23:43:37 -0000	1.135.2.15
  @@ -1040,7 +1040,10 @@
        * - open the RewriteMap prg:xxx programs
        */
       for (; s; s = s->next) {
  -        open_rewritelog(s, p);
  +        if (!open_rewritelog(s, p)) {
  +            return HTTP_INTERNAL_SERVER_ERROR;
  +        }
  +
           if (!first_time) {
               if (run_rewritemap_programs(s, p) != APR_SUCCESS) {
                   return HTTP_INTERNAL_SERVER_ERROR;
  @@ -3400,7 +3403,7 @@
   */
   
   
  -static void open_rewritelog(server_rec *s, apr_pool_t *p)
  +static int open_rewritelog(server_rec *s, apr_pool_t *p)
   {
       rewrite_server_conf *conf;
       const char *fname;
  @@ -3412,14 +3415,12 @@
   
       conf = ap_get_module_config(s->module_config, &rewrite_module);
   
  -    if (conf->rewritelogfile == NULL) {
  -        return;
  -    }
  -    if (*(conf->rewritelogfile) == '\0') {
  -        return;
  -    }
  -    if (conf->rewritelogfp != NULL) {
  -        return; /* virtual log shared w/ main server */
  +    /* - no logfile configured
  +     * - logfilename empty
  +     * - virtual log shared w/ main server
  +     */
  +    if (!conf->rewritelogfile || !*conf->rewritelogfile || conf->rewritelogfp)
{
  +        return 1;
       }
   
       if (*conf->rewritelogfile == '|') {
  @@ -3427,7 +3428,7 @@
               ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
                            "mod_rewrite: could not open reliable pipe "
                            "to RewriteLog filter %s", conf->rewritelogfile+1);
  -            exit(1);
  +            return 0;
           }
           conf->rewritelogfp = ap_piped_log_write_fd(pl);
       }
  @@ -3437,7 +3438,7 @@
               ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s,
                            "mod_rewrite: Invalid RewriteLog "
                            "path %s", conf->rewritelogfile);
  -            exit(1);
  +            return 0;
           }
           if ((rc = apr_file_open(&conf->rewritelogfp, fname,
                                   rewritelog_flags, rewritelog_mode, p))
  @@ -3445,10 +3446,11 @@
               ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
                            "mod_rewrite: could not open RewriteLog "
                            "file %s", fname);
  -            exit(1);
  +            return 0;
           }
       }
  -    return;
  +
  +    return 1;
   }
   
   static void rewritelog(request_rec *r, int level, const char *text, ...)
  
  
  
  1.39.2.5  +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.39.2.4
  retrieving revision 1.39.2.5
  diff -u -r1.39.2.4 -r1.39.2.5
  --- mod_rewrite.h	19 May 2003 02:25:19 -0000	1.39.2.4
  +++ mod_rewrite.h	31 Jul 2003 23:43:37 -0000	1.39.2.5
  @@ -440,7 +440,7 @@
   static int   rewrite_rand(int l, int h);
   
       /* rewriting logfile support */
  -static void  open_rewritelog(server_rec *s, apr_pool_t *p);
  +static int   open_rewritelog(server_rec *s, apr_pool_t *p);
   static void  rewritelog(request_rec *r, int level, const char *text, ...)
                           __attribute__((format(printf,3,4)));
   static char *current_logtime(request_rec *r);
  
  
  

Mime
View raw message