httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/generators mod_cgi.c
Date Fri, 04 Apr 2003 18:55:49 GMT
trawick     2003/04/04 10:55:49

  Modified:    .        CHANGES
               modules/filters mod_ext_filter.c
               modules/generators mod_cgi.c
  Log:
  Fix the inability to log errors like exec failure in
  mod_ext_filter/mod_cgi script children (e.g., exec failure).  This
  was broken after such children stopped inheriting the error log
  handle.
  
  (For this to work with mod_ext_filter, that module's LogStderr option
  has to be on.)
  
  Revision  Changes    Path
  1.1137    +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1136
  retrieving revision 1.1137
  diff -u -r1.1136 -r1.1137
  --- CHANGES	4 Apr 2003 03:57:09 -0000	1.1136
  +++ CHANGES	4 Apr 2003 18:55:48 -0000	1.1137
  @@ -2,6 +2,11 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Fix the inability to log errors like exec failure in
  +     mod_ext_filter/mod_cgi script children (e.g., exec failure).  This
  +     was broken after such children stopped inheriting the error log
  +     handle.  [Jeff Trawick]
  +
     *) Fix a compile failure with recent OpenSSL and picky compilers
        (e.g., OpenSSL 0.9.7a and xlc_r on AIX).  [Jeff Trawick]
   
  
  
  
  1.5       +15 -4     httpd-2.0/modules/filters/mod_ext_filter.c
  
  Index: mod_ext_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/filters/mod_ext_filter.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- mod_ext_filter.c	12 Feb 2003 18:27:37 -0000	1.4
  +++ mod_ext_filter.c	4 Apr 2003 18:55:49 -0000	1.5
  @@ -69,6 +69,7 @@
   #include "apr_buckets.h"
   #include "util_filter.h"
   #include "util_script.h"
  +#include "util_time.h"
   #include "apr_strings.h"
   #include "apr_hash.h"
   #include "apr_lib.h"
  @@ -423,15 +424,25 @@
       return apr_file_close(vfile);
   }
   
  -static void child_errfn(apr_pool_t *p, apr_status_t err, const char *desc)
  +static void child_errfn(apr_pool_t *pool, apr_status_t err, const char *description)
   {
       request_rec *r;
       void *vr;
  +    apr_file_t *stderr_log;
  +    char errbuf[200];
  +    char time_str[APR_CTIME_LEN];
   
  -    apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, p);
  +    apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
       r = vr;
  -    
  -    ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "%s", desc);
  +    apr_file_open_stderr(&stderr_log, pool);
  +    ap_recent_ctime(time_str, apr_time_now());
  +    apr_file_printf(stderr_log,
  +                    "[%s] [client %s] mod_ext_filter (%d)%s: %s\n",
  +                    time_str,
  +                    r->connection->remote_ip,
  +                    err,
  +                    apr_strerror(err, errbuf, sizeof(errbuf)),
  +                    description);
   }
   
   /* init_ext_filter_process: get the external filter process going
  
  
  
  1.152     +8 -10     httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.151
  retrieving revision 1.152
  diff -u -r1.151 -r1.152
  --- mod_cgi.c	12 Feb 2003 18:27:37 -0000	1.151
  +++ mod_cgi.c	4 Apr 2003 18:55:49 -0000	1.152
  @@ -122,8 +122,6 @@
   #define DEFAULT_LOGBYTES 10385760
   #define DEFAULT_BUFBYTES 1024
   
  -#define ERRFN_USERDATA_KEY         "CGICHILDERRFN"
  -
   typedef struct {
       const char *logname;
       long        logbytes;
  @@ -385,13 +383,15 @@
   static void cgi_child_errfn(apr_pool_t *pool, apr_status_t err,
                               const char *description)
   {
  -    request_rec *r;
  -    void *vr;
  -
  -    apr_pool_userdata_get(&vr, ERRFN_USERDATA_KEY, pool);
  -    r = vr;
  +    apr_file_t *stderr_log;
  +    char errbuf[200];
   
  -    ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "%s", description);
  +    apr_file_open_stderr(&stderr_log, pool);
  +    apr_file_printf(stderr_log,
  +                    "(%d)%s: %s\n",
  +                    err,
  +                    apr_strerror(err, errbuf, sizeof(errbuf)),
  +                    description);
   }
   
   static apr_status_t run_cgi_child(apr_file_t **script_out,
  @@ -473,8 +473,6 @@
                         "couldn't set child process attributes: %s", r->filename);
       }
       else {
  -        apr_pool_userdata_set(r, ERRFN_USERDATA_KEY, apr_pool_cleanup_null, p);
  -
           procnew = apr_pcalloc(p, sizeof(*procnew));
           if (e_info->prog_type == RUN_AS_SSI) {
               SPLIT_AND_PASS_PRETAG_BUCKETS(*(e_info->bb), e_info->ctx,
  
  
  

Mime
View raw message