httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Re: 1.0 release sources and the Binary release
Date Sat, 02 Dec 1995 15:43:13 GMT
It has bugs (however, I back the principle):

> 
> 
> *sigh* I'm going to become famous for this late patch thing...
> 
> David was correct that there are some problem with a couple
> of these add-on log modules. The cookie logger had been fixed
> to prevent logging if there is no CookieLog directive in the
> config files.  I also discovered that mod_cookies would fail
> silently if it did not successfully open the log file setting
> up a potential segmentation violation later.
> 
> The good news, I've fixed all of these things with the following
> patch.... I have tested this both in a standard config and with
> virtual host agent, referer, cookie logs.  It all works.
> 
> If the group will back this change, I will be happy to re-roll
> the source code. If not, I suggest that we do not include these
> modules in the binary release.
> 
> Comments?
> 
> 
> *** mod_log_agent.c.orig	Sat Dec  2 08:47:21 1995
> --- mod_log_agent.c	Sat Dec  2 09:11:05 1995
> ***************
> *** 56,63 ****
>   #include "httpd.h"
>   #include "http_config.h"
>   
> - #define DEFAULT_AGENTLOG "logs/agent_log"
> - 
>   module agent_log_module;
>   
>   static int xfer_flags = ( O_WRONLY | O_APPEND | O_CREAT );
> --- 56,61 ----
> ***************
> *** 73,79 ****
>       agent_log_state *cls =
>         (agent_log_state *)palloc (p, sizeof (agent_log_state));
>   
> !     cls->fname = DEFAULT_AGENTLOG;
>       cls->agent_fd = -1;
>   
>   
> --- 71,77 ----
>       agent_log_state *cls =
>         (agent_log_state *)palloc (p, sizeof (agent_log_state));
>   
> !     cls->fname = "";
>       cls->agent_fd = -1;
>   
>   
> ***************
> *** 130,139 ****
>   
>   	cls->agent_fd = fileno (dummy);
>       }
> !     else if((cls->agent_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
> !         fprintf(stderr,"httpd: could not open transfer log file %s.\n", fname);
>           perror("open");
>           exit(1);
>       }
>   }
>   
> --- 128,139 ----
>   
>   	cls->agent_fd = fileno (dummy);
>       }
> !     else if(*cls->fname != NULL) {
> !       if((cls->agent_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
> !         fprintf(stderr,"httpd: could not open agent log file %s.\n", fname);
>           perror("open");
>           exit(1);
> +       }
>       }
>   }
>   
> ***************
> *** 156,161 ****
> --- 156,163 ----
>   
>       for (r = orig; r->next; r = r->next)
>           continue;
> +     if (cls->fname == "")	/* Don't log agent */
                       ^^^^^ Oooops!
> + 	return DECLINED;
>   
>       agent = table_get(orig->headers_in, "User-Agent");
>       if(agent != NULL) 
> 
> *** mod_log_referer.c.orig	Sat Dec  2 08:54:25 1995
> --- mod_log_referer.c	Sat Dec  2 09:11:29 1995
> ***************
> *** 56,63 ****
>   #include "httpd.h"
>   #include "http_config.h"
>   
> - #define DEFAULT_REFERERLOG "logs/referer_log"
> - 
>   module referer_log_module;
>   
>   static int xfer_flags = ( O_WRONLY | O_APPEND | O_CREAT );
> --- 56,61 ----
> ***************
> *** 74,80 ****
>       referer_log_state *cls =
>         (referer_log_state *)palloc (p, sizeof (referer_log_state));
>   
> !     cls->fname = DEFAULT_REFERERLOG;
>       cls->referer_fd = -1;
>       cls->referer_ignore_list = make_array(p, 1, sizeof(char *));
>       return (void *)cls;
> --- 72,78 ----
>       referer_log_state *cls =
>         (referer_log_state *)palloc (p, sizeof (referer_log_state));
>   
> !     cls->fname = "";
>       cls->referer_fd = -1;
>       cls->referer_ignore_list = make_array(p, 1, sizeof(char *));
>       return (void *)cls;
> ***************
> *** 144,153 ****
>   
>   	cls->referer_fd = fileno (dummy);
>       }
> !     else if((cls->referer_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0)
{
> !         fprintf(stderr,"httpd: could not open transfer log file %s.\n", fname);
>           perror("open");
>           exit(1);
>       }
>   }
>   
> --- 142,153 ----
>   
>   	cls->referer_fd = fileno (dummy);
>       }
> !     else if(*cls->fname != NULL) {
> !       if((cls->referer_fd = popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
> !         fprintf(stderr,"httpd: could not open referer log file %s.\n", fname);
>           perror("open");
>           exit(1);
> +       }
>       }
>   }
>   
> ***************
> *** 171,176 ****
> --- 171,178 ----
>   
>       for (r = orig; r->next; r = r->next)
>           continue;
> +     if (cls->fname == "")	/* Don't log referer */
                       ^^^^^ and again
> + 	return DECLINED;
>       
>       referer = table_get(orig->headers_in, "Referer");
>       if(referer != NULL)
> 
> *** mod_cookies.c.orig	Sat Dec  2 09:21:54 1995
> --- mod_cookies.c	Sat Dec  2 09:23:05 1995
> ***************
> *** 153,159 ****
>       char *fname = server_root_relative (p, cls->fname);
>   
>       if (cls->log_fd > 0) return; 
> !     cls->log_fd = popenf(p, fname, cookie_flags, cookie_mode);
>   }
>   
>   void init_cookie_log (server_rec *s, pool *p)
> --- 153,165 ----
>       char *fname = server_root_relative (p, cls->fname);
>   
>       if (cls->log_fd > 0) return; 
> !     if(*cls->fname != NULL) {

This construction is, strictly, wrong (though it usually works). It irritates
me to see it, the correct thing to say is:

     if(*cls->fname != '\0') {

I know this appears all over the place. Its one of the things I intend to fix
post-1.0.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");
> ! 	exit(1);
> !       }
> !     }
>   }
>   
>   void init_cookie_log (server_rec *s, pool *p)
> ***************
> *** 174,181 ****
>   
>       for (r = orig; r->next; r = r->next)
>           continue;
> !     if ((cls->log_fd)<0)	/* Don't log cookies */
> ! 	return DECLINED;
>   
>       if (!(cookie = table_get (r->headers_in, "Cookie")))
>           return DECLINED;    /* Theres no cookie, don't bother logging */
> --- 180,187 ----
>   
>       for (r = orig; r->next; r = r->next)
>           continue;
> !     if (cls->fname == "")	/* Don't log cookies */
                       ^^^^^ and again
> !       return DECLINED;
>   
>       if (!(cookie = table_get (r->headers_in, "Cookie")))
>           return DECLINED;    /* Theres no cookie, don't bother logging */
> 
> 

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message