You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rs...@hyperreal.org on 1998/05/20 17:34:28 UTC

cvs commit: apache-1.3/src/modules/standard mod_rewrite.c mod_rewrite.h

rse         98/05/20 08:34:28

  Modified:    src      CHANGES
               src/modules/standard mod_rewrite.c mod_rewrite.h
  Log:
  Step 1/2 for repairing mod_rewrite after the recent child spawning changes
  (child_info *pinfo !!). This is the easier part: We just avoid fiddling with
  the pinfo stuff by using the reliable piped logs. Beside this repair reason
  its the preferred way, too. The previous code in mod_rewrite is from dates
  where no reliable piped logs exist ;-)
  
  Revision  Changes    Path
  1.855     +4 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.854
  retrieving revision 1.855
  diff -u -r1.854 -r1.855
  --- CHANGES	1998/05/20 04:22:06	1.854
  +++ CHANGES	1998/05/20 15:34:24	1.855
  @@ -1,5 +1,9 @@
   Changes with Apache 1.3b7
   
  +  *) Make mod_rewrite use ap_open_piped_log() for RewriteLog directive's
  +     logfile instead of fiddling around itself with child spawning stuff.
  +     [Ralf S. Engelschall]
  +
     *) Made RefererIgnore case-insensitive.
   
     *) Mod_log_agent, mod_log_referer now use ap_open_piped_log for piped logs.
  
  
  
  1.105     +6 -28     apache-1.3/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- mod_rewrite.c	1998/05/19 19:19:02	1.104
  +++ mod_rewrite.c	1998/05/20 15:34:26	1.105
  @@ -2843,7 +2843,7 @@
   {
       rewrite_server_conf *conf;
       char *fname;
  -    FILE *fp;
  +    piped_log *pl;
       int    rewritelog_flags = ( O_WRONLY|O_APPEND|O_CREAT );
   #ifdef WIN32
       mode_t rewritelog_mode=_S_IREAD|_S_IWRITE;
  @@ -2863,15 +2863,14 @@
       fname = ap_server_root_relative(p, conf->rewritelogfile);
   
       if (*conf->rewritelogfile == '|') {
  -        if (!spawn_child(p, rewritelog_child, (void *)(conf->rewritelogfile+1),
  -                    kill_after_timeout, &fp, NULL)) {
  -            perror("spawn_child");
  +        if ((pl = ap_open_piped_log(p, conf->rewritelogfile+1)) == NULL) {
  +            perror("ap_open_piped_log");
               fprintf(stderr,
  -                    "mod_rewrite: could not fork child for "
  -                    "RewriteLog process\n");
  +                    "mod_rewrite: could not open reliable piped log for "
  +                    "RewriteLog\n");
               exit (1);
           }
  -        conf->rewritelogfp = fileno(fp);
  +        conf->rewritelogfp = ap_piped_log_write_fd(pl);
       }
       else if (*conf->rewritelogfile != '\0') {
           if ((conf->rewritelogfp = ap_popenf(p, fname, rewritelog_flags,
  @@ -2884,27 +2883,6 @@
           }
       }
       return;
  -}
  -
  -/* Child process code for 'RewriteLog "|..."' */
  -static int rewritelog_child(void *cmd, child_info *pinfo)
  -{
  -    int child_pid = 1;
  -
  -    ap_cleanup_for_exec();
  -#ifdef SIGHUP
  -    signal(SIGHUP, SIG_IGN);
  -#endif
  -#if defined(WIN32)
  -    child_pid = spawnl(_P_NOWAIT, SHELL_PATH, SHELL_PATH, "/c",
  -                       (char *)cmd, NULL);
  -#elif defined(__EMX__)
  -    /* OS/2 needs a '/' */
  -    execl(SHELL_PATH, SHELL_PATH, "/c", (char *)cmd, NULL);
  -#else
  -    execl(SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  -#endif
  -    return(child_pid);
   }
   
   static void rewritelog(request_rec *r, int level, const char *text, ...)
  
  
  
  1.51      +0 -1      apache-1.3/src/modules/standard/mod_rewrite.h
  
  Index: mod_rewrite.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- mod_rewrite.h	1998/05/19 19:19:03	1.50
  +++ mod_rewrite.h	1998/05/20 15:34:27	1.51
  @@ -424,7 +424,6 @@
   
       /* rewriting logfile support */
   static void  open_rewritelog(server_rec *s, pool *p);
  -static int   rewritelog_child(void *cmd, child_info *pinfo);
   static void  rewritelog(request_rec *r, int level, const char *text, ...)
                           __attribute__((format(printf,3,4)));
   static char *current_logtime(request_rec *r);