--- old_mod_cgi.c 2006-03-14 12:29:13.000000000 +0000 +++ old_mod_cgi.c 2006-03-14 12:27:13.000000000 +0000 @@ -757,7 +757,13 @@ p = r->main ? r->main->pool : r->pool; argv0 = apr_filepath_name_get(r->filename); - nph = !(strncmp(argv0, "nph-", 4)); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Identifying cgi script:%s", r->filename); + nph = ( strstr(argv0,"nph-") != NULL ); + if (nph) + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Identified an nph-cgi script"); + else + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Identified a non nph-cgi script"); + conf = ap_get_module_config(r->server->module_config, &cgi_module); if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r)) @@ -974,19 +980,50 @@ rv = ap_pass_brigade(r->output_filters, bb); } else /* nph */ { - struct ap_filter_t *cur; - - /* get rid of all filters up through protocol... since we + /* Now get rid of all filters up through protocol... since we * haven't parsed off the headers, there is no way they can * work */ +/* check to see if r is the main request */ + if (ap_is_initial_req(r) != 1) { + request_rec* rp = r->prev; + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "This request is a sub %d",rp); + struct ap_filter_t *mof; + mof = rp->output_filters; + while ( mof ) { + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Found filter: %s",mof->frec->name); + mof = mof->next; + } + mof = rp->connection->output_filters; + while ( mof && mof->frec->ftype < AP_FTYPE_TRANSCODE ) { + mof = mof->next; + } + rp->connection->output_filters = rp->output_filters = rp->proto_output_filters = mof; + } else { + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "This request is not a sub %d",r->prev); + } + struct ap_filter_t *cur; + + cur = r->output_filters; + while ( cur ) { + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Found filter: %s",cur->frec->name); + cur = cur->next; + } + + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "nph-cgi bypassing filters.."); - cur = r->proto_output_filters; - while (cur && cur->frec->ftype < AP_FTYPE_CONNECTION) { + cur = r->connection->output_filters; + while (cur && cur->frec->ftype < AP_FTYPE_TRANSCODE ) { cur = cur->next; } - r->output_filters = r->proto_output_filters = cur; + r->connection->output_filters = r->output_filters = r->proto_output_filters = cur; + cur = r->output_filters; + while ( cur ) { + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Remaining filter: %s",cur->frec->name); + cur = cur->next; + } + rv = ap_pass_brigade(r->output_filters, bb); } @@ -1000,7 +1037,6 @@ } apr_file_close(script_err); - return OK; /* NOT r->status, even if it has changed. */ }