You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2003/11/13 19:33:42 UTC

cvs commit: httpd-2.0/modules/generators mod_cgi.c

trawick     2003/11/13 10:33:42

  Modified:    .        Tag: APACHE_2_0_BRANCH STATUS CHANGES
               modules/filters Tag: APACHE_2_0_BRANCH mod_ext_filter.c
               modules/generators Tag: APACHE_2_0_BRANCH mod_cgi.c
  Log:
  merge this from 2.1-dev:
  
    Fix the inability to log errors like exec failure in
    mod_ext_filter/mod_cgi script children.  This was broken after
    such children stopped inheriting the error log handle.
  
  Reviewed by: nd, jorton
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.751.2.538 +1 -8      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.537
  retrieving revision 1.751.2.538
  diff -u -r1.751.2.537 -r1.751.2.538
  --- STATUS	13 Nov 2003 18:04:16 -0000	1.751.2.537
  +++ STATUS	13 Nov 2003 18:33:40 -0000	1.751.2.538
  @@ -262,13 +262,6 @@
           modules/ssl/ssl_engine_io.c r1.111
         +1: jorton
   
  -    * Fix the inability to log errors like exec failure in
  -      mod_ext_filter/mod_cgi script children.  This was broken after 
  -      such children stopped inheriting the error log handle.
  -        modules/generators/mod_cgi.c r1.152
  -        modules/filters/mod_ext_filter.c r1.5
  -      +1: trawick, nd, jorton
  -
       * When UseCanonicalName is set to OFF, allow ap_get_server_port to 
         check r->connection->local_addr->port before defaulting to 
         server->port or ap_default_port()
  
  
  
  1.988.2.180 +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.179
  retrieving revision 1.988.2.180
  diff -u -r1.988.2.179 -r1.988.2.180
  --- CHANGES	12 Nov 2003 01:50:40 -0000	1.988.2.179
  +++ CHANGES	13 Nov 2003 18:33:41 -0000	1.988.2.180
  @@ -1,5 +1,10 @@
   Changes with Apache 2.0.49
   
  +  *) Fix the inability to log errors like exec failure in
  +     mod_ext_filter/mod_cgi script children.  This was broken after 
  +     such children stopped inheriting the error log handle.  
  +     [Jeff Trawick]
  +
     *) Fix mod_info to use the real config file name, not the default
        config file name.  [Aryeh Katz <aryeh secured-services.com>]
   
  
  
  
  No                   revision
  No                   revision
  1.1.2.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.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- mod_ext_filter.c	28 Jul 2003 01:54:17 -0000	1.1.2.4
  +++ mod_ext_filter.c	13 Nov 2003 18:33:42 -0000	1.1.2.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
  
  
  
  No                   revision
  No                   revision
  1.148.2.4 +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.148.2.3
  retrieving revision 1.148.2.4
  diff -u -r1.148.2.3 -r1.148.2.4
  --- mod_cgi.c	27 Feb 2003 12:33:07 -0000	1.148.2.3
  +++ mod_cgi.c	13 Nov 2003 18:33:42 -0000	1.148.2.4
  @@ -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,