httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: httpd-2.0/modules/generators mod_cgi.c
Date Wed, 05 May 2004 14:52:44 GMT
jorton      2004/05/05 07:52:44

  Modified:    modules/generators mod_cgi.c
  Log:
  * modules/generators/mod_cgi.c (cgi_handler): Combine common code
  between nph and non-nph handling; use a CGI bucket for both cases if
  APR_FILES_AS_SOCKETS.
  
  Revision  Changes    Path
  1.162     +20 -23    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.161
  retrieving revision 1.162
  diff -u -r1.161 -r1.162
  --- mod_cgi.c	18 Apr 2004 16:02:57 -0000	1.161
  +++ mod_cgi.c	5 May 2004 14:52:44 -0000	1.162
  @@ -726,6 +726,7 @@
       cgi_server_conf *conf;
       apr_status_t rv;
       cgi_exec_info_t e_info;
  +    conn_rec *c = r->connection;
   
       if(strcmp(r->handler, CGI_MAGIC_TYPE) && strcmp(r->handler, "cgi-script"))
           return DECLINED;
  @@ -807,7 +808,7 @@
       /* Transfer any put/post args, CERN style...
        * Note that we already ignore SIGPIPE in the core server.
        */
  -    bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
  +    bb = apr_brigade_create(r->pool, c->bucket_alloc);
       seen_eos = 0;
       child_stopped_reading = 0;
       if (conf->logname) {
  @@ -883,24 +884,27 @@
       apr_file_flush(script_out);
       apr_file_close(script_out);
   
  -    /* Handle script return... */
  -    if (script_in && !nph) {
  -        conn_rec *c = r->connection;
  -        const char *location;
  -        char sbuf[MAX_STRING_LEN];
  -        int ret;
  +    AP_DEBUG_ASSERT(script_in != NULL);
   
  -#if APR_FILES_AS_SOCKETS
  -        apr_file_pipe_timeout_set(script_in, 0);
  -        apr_file_pipe_timeout_set(script_err, 0);
  +    apr_brigade_cleanup(bb);
   
  -        b = cgi_bucket_create(r, script_in, script_err, c->bucket_alloc);
  +#if APR_FILES_AS_SOCKETS
  +    apr_file_pipe_timeout_set(script_in, 0);
  +    apr_file_pipe_timeout_set(script_err, 0);
  +    
  +    b = cgi_bucket_create(r, script_in, script_err, c->bucket_alloc);
   #else
  -        b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
  +    b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
   #endif
  -        APR_BRIGADE_INSERT_TAIL(bb, b);
  -        b = apr_bucket_eos_create(c->bucket_alloc);
  -        APR_BRIGADE_INSERT_TAIL(bb, b);
  +    APR_BRIGADE_INSERT_TAIL(bb, b);
  +    b = apr_bucket_eos_create(c->bucket_alloc);
  +    APR_BRIGADE_INSERT_TAIL(bb, b);
  +
  +    /* Handle script return... */
  +    if (!nph) {
  +        const char *location;
  +        char sbuf[MAX_STRING_LEN];
  +        int ret;
   
           if ((ret = ap_scan_script_header_err_brigade(r, bb, sbuf))) {
               return log_script(r, conf, ret, dbuf, sbuf, bb, script_err);
  @@ -952,9 +956,7 @@
   
           apr_file_close(script_err);
       }
  -
  -    if (script_in && nph) {
  -        conn_rec *c = r->connection;
  +    else /* nph */ {
           struct ap_filter_t *cur;
           
           /* get rid of all filters up through protocol...  since we
  @@ -968,11 +970,6 @@
           }
           r->output_filters = r->proto_output_filters = cur;
   
  -        bb = apr_brigade_create(r->pool, c->bucket_alloc);
  -        b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
  -        APR_BRIGADE_INSERT_TAIL(bb, b);
  -        b = apr_bucket_eos_create(c->bucket_alloc);
  -        APR_BRIGADE_INSERT_TAIL(bb, b);
           ap_pass_brigade(r->output_filters, bb);
       }
   
  
  
  

Mime
View raw message