From 5b3c8b1c328408b0f3391996cdb6e3c88f67a9ef Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Sat, 26 Aug 2000 19:45:15 +0000 Subject: [PATCH] Call ap_pass_brigade() *before* soaking up stderr. The normal CGI is going to write a bunch of stuff to stdout and nothing to stderr. Reading stderr before processing the stdout pipe can cause deadlock if the CGI fills the kernel buffer for stdout because the CGI will stall writing to stdout while the httpd process will stall reading from the CGI's stderr. The NPH CGI behavior was unchanged. If this is still a problem for NPH CGIs, it was a problem before filtering too. Also, get rid of a couple of unused variables in cgi_handler. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86150 13f79535-47bb-0310-9956-ffa450edef68 --- modules/generators/mod_cgi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 183365f0cc..d929167181 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -311,8 +311,6 @@ static apr_status_t run_cgi_child(apr_file_t **script_out, apr_file_t **script_i apr_procattr_t *procattr; apr_proc_t *procnew = apr_pcalloc(p, sizeof(*procnew)); apr_status_t rc = APR_SUCCESS; - apr_file_t *file = NULL; - apr_socket_t *sock = NULL; #if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || \ defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined (RLIMIT_AS) core_dir_config *conf; @@ -661,6 +659,7 @@ static int cgi_handler(request_rec *r) ap_brigade_append_buckets(bb, ap_bucket_create_pipe(script_in)); ap_brigade_append_buckets(bb, ap_bucket_create_eos()); } + ap_pass_brigade(r->filters, bb); log_script_err(r, script_err); apr_close(script_err); @@ -670,9 +669,9 @@ static int cgi_handler(request_rec *r) bb = ap_brigade_create(r->pool); ap_brigade_append_buckets(bb, ap_bucket_create_pipe(script_in)); ap_brigade_append_buckets(bb, ap_bucket_create_eos()); + ap_pass_brigade(r->filters, bb); } - ap_pass_brigade(r->filters, bb); return OK; /* NOT r->status, even if it has changed. */ } -- 2.50.1