You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by nd...@apache.org on 2004/01/12 22:19:59 UTC

cvs commit: httpd-2.0/server log.c

nd          2004/01/12 13:19:58

  Modified:    .        CHANGES
               server   log.c
  Log:
  allow unescaped errorlogs via compile time switch
  
  Submitted by: Geoffrey Young <geoff modperlcookbook.org>
  
  Revision  Changes    Path
  1.1361    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1360
  retrieving revision 1.1361
  diff -u -u -r1.1360 -r1.1361
  --- CHANGES	12 Jan 2004 18:36:10 -0000	1.1360
  +++ CHANGES	12 Jan 2004 21:19:58 -0000	1.1361
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Allow unescaped error logs via compile time switch
  +     "-DAP_ERROR_LOG_UNESCAPED".
  +     [Geoffrey Young <geoff modperlcookbook.org>, Andr� Malo]
  +
     *) proxy_http fix: mod_proxy hangs when both KeepAlive and 
        ProxyErrorOverride are enabled, and a non-200 response without a 
        body is generated by the backend server. (e.g.: a client makes a 
  
  
  
  1.139     +19 -3     httpd-2.0/server/log.c
  
  Index: log.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/log.c,v
  retrieving revision 1.138
  retrieving revision 1.139
  diff -u -u -r1.138 -r1.139
  --- log.c	1 Jan 2004 13:26:23 -0000	1.138
  +++ log.c	12 Jan 2004 21:19:58 -0000	1.139
  @@ -402,7 +402,10 @@
                              const request_rec *r, apr_pool_t *pool,
                              const char *fmt, va_list args)
   {
  -    char errstr[MAX_STRING_LEN], scratch[MAX_STRING_LEN];
  +    char errstr[MAX_STRING_LEN];
  +#ifndef AP_ERROR_LOG_UNESCAPED
  +    char scratch[MAX_STRING_LEN];
  +#endif
       apr_size_t len, errstrlen;
       apr_file_t *logf = NULL;
       const char *referer;
  @@ -539,15 +542,28 @@
       }
   
       errstrlen = len;
  +#ifndef AP_ERROR_LOG_UNESCAPED
       if (apr_vsnprintf(scratch, MAX_STRING_LEN - len, fmt, args)) {
           len += ap_escape_errorlog_item(errstr + len, scratch,
                                          MAX_STRING_LEN - len);
       }
  +#else
  +    len += apr_vsnprintf(errstr + len, MAX_STRING_LEN - len, fmt, args);
  +#endif
   
       if (   r && (referer = apr_table_get(r->headers_in, "Referer"))
  -        && ap_escape_errorlog_item(scratch, referer, MAX_STRING_LEN - len)) {
  +#ifndef AP_ERROR_LOG_UNESCAPED
  +        && ap_escape_errorlog_item(scratch, referer, MAX_STRING_LEN - len)
  +#endif
  +        ) {
           len += apr_snprintf(errstr + len, MAX_STRING_LEN - len,
  -                            ", referer: %s", scratch);
  +                            ", referer: %s",
  +#ifndef AP_ERROR_LOG_UNESCAPED
  +                            scratch
  +#else
  +                            referer
  +#endif
  +                            );
       }
   
       /* NULL if we are logging to syslog */
  
  
  

Re: cvs commit: httpd-2.0/server log.c

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
>   +  *) Allow unescaped error logs via compile time switch
>   +     "-DAP_ERROR_LOG_UNESCAPED".
>   +     [Geoffrey Young <geoff modperlcookbook.org>, André Malo]

ah, cool :)

if it's all the same to everyone, I actually like joe's suggested
-DUNSAFE_LOG_ESCAPING (or some error_log derivitave) a bit better - undoing
the default should raise some eyebrows.

--Geoff