You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by Mark Cox <mj...@hyperreal.com> on 1996/04/04 16:54:04 UTC

cvs commit: apache/src mod_cookies.c CHANGES

mjc         96/04/04 06:54:04

  Modified:    src       mod_cookies.c CHANGES
  Log:
  Reviewed by: Mark Cox
  Submitted by: James H. Cloos Jr. <cl...@jhcloos.com>
  
  This patch allows the cookie log to go to a pipe rather than just to a
  file.  The new code was taken from mod_log_agent.c.
  
  Revision  Changes    Path
  1.7       +32 -1     apache/src/mod_cookies.c
  
  Index: mod_cookies.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_cookies.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -C3 -r1.6 -r1.7
  *** mod_cookies.c	1996/03/18 10:49:16	1.6
  --- mod_cookies.c	1996/04/04 14:54:01	1.7
  ***************
  *** 81,86 ****
  --- 81,90 ----
     *
     * 18.3.96 MJC Generate cookies for EVERY request no matter what the 
     * browser.
  +  *
  +  * 96/03/31 -JimC Allow the log to be sent to a pipe.  Copies the relevant
  +  * code from mod_log_agent.c.
  +  *
     */
    
    #include "httpd.h"
  ***************
  *** 166,171 ****
  --- 170,188 ----
    { NULL }
    };
    
  + void cookie_log_child (void *cmd)
  + {
  +     /* Child process code for 'CookieLog "|..."';
  +      * may want a common framework for this, since I expect it will
  +      * be common for other foo-loggers to want this sort of thing...
  +      */
  +     
  +     cleanup_for_exec();
  +     signal (SIGHUP, SIG_IGN);
  +     execl (SHELL_PATH, SHELL_PATH, "-c", (char *)cmd, NULL);
  +     exit (1);
  + }
  + 
    void open_cookie_log (server_rec *s, pool *p)
    {
        cookie_log_state *cls = get_module_config (s->module_config,
  ***************
  *** 173,179 ****
        char *fname = server_root_relative (p, cls->fname);
    
        if (cls->log_fd > 0) return; 
  !     if(*cls->fname != '\0') {
          if((cls->log_fd = popenf(p, fname, cookie_flags, cookie_mode)) < 0) {
    	fprintf(stderr, "httpd: could not open cookie log file %s.\n", fname);
    	perror("open");
  --- 190,210 ----
        char *fname = server_root_relative (p, cls->fname);
    
        if (cls->log_fd > 0) return; 
  ! 
  !     if (*cls->fname == '|') {
  !       FILE *dummy;
  !       
  !       spawn_child(p, cookie_log_child, (void *)(cls->fname+1),
  !                 kill_after_timeout, &dummy, NULL);
  !       
  !       if (dummy == NULL) {
  !       fprintf (stderr, "Couldn't fork child for CookieLog process\n");
  !       exit (1);
  !       }
  !       
  !       cls->log_fd = fileno (dummy);
  !     }
  !     else if(*cls->fname != '\0') {
          if((cls->log_fd = popenf(p, fname, cookie_flags, cookie_mode)) < 0) {
    	fprintf(stderr, "httpd: could not open cookie log file %s.\n", fname);
    	perror("open");
  
  
  
  1.21      +1 -3      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -C3 -r1.20 -r1.21
  *** CHANGES	1996/04/02 10:20:49	1.20
  --- CHANGES	1996/04/04 14:54:02	1.21
  ***************
  *** 52,60 ****
      *) Long overdue revamp of the Cookies module to stop Apache cookies
         colliding with other cookies a site may be using.  Cookies are now
         always generated for every browser, not just Netscape (and clones)
  !      [Mark Cox]
  ! 
  !   *) Clean up strings.h warning for SGI [Mark Cox]
    
      *) Add HAVE_MMAP to SCO 5. [Ben Laurie]
    
  --- 52,58 ----
      *) Long overdue revamp of the Cookies module to stop Apache cookies
         colliding with other cookies a site may be using.  Cookies are now
         always generated for every browser, not just Netscape (and clones)
  !      and the cookie log can be a pipe just like the other logs [Mark Cox]
    
      *) Add HAVE_MMAP to SCO 5. [Ben Laurie]