httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject Re: CGI bucket needed
Date Wed, 25 Sep 2002 04:43:53 GMT
At 09:06 PM 9/24/2002, Greg Stein wrote:

>I believe the solution is to create a new CGI bucket type. The read()
>function would read from stdout, similar to a normal PIPE bucket (e.g.
>create a new HEAP bucket with the results). However, the bucket *also* holds
>the stderr pipe from the CGI script. When you do a bucket read(), it
>actually blocks on both pipes. If data comes in from stderr, then it drains
>it and sends that to the error log. Data that comes in from stdout is
>handled normally.

I believe a better answer is to finally allow polling on a filter chain.
This isn't as trivial (perhaps) but it's certainly more useful.

Consider a POST request to a mod_ext_filter parsed CGI document...

The input chain is...

 socket read from client
  \-- pipe write to ext_filter_in stdin
       \-- pipe read from ext_filter_in stdout
            \-- pipe write to cgi stdin

The output chain is...

 pipe read from cgi stdout
  \-- pipe write to ext_filter stdin
       \-- pipe read to ext_filter stdout
            \-- socket write to client

All the while we have...

 pipe read from cgi stderr
  \-- file write to errlog

Lost track of what we are blocking on yet?  You certainly can,
take the ext_filter'ed cgi stdout.  Is there data waiting on the
cgi stdout, or are we blocked on pipe read from the ext_filter's
stdout?  If it's the later, is it a long-running ext_filter taking several
seconds to generate output, or does it need more data pumped to
it's stdin in order to formulate more output?

In the nasty example above, we truly have up to ten different items
to poll at the same time.  Pretty harry.

The thought is, if we call pass_brigade or read_brigade in a 
non-blocking mode, and nothing can be processed, we get back
a bucket containing a pollset of some sort (either multiple handles
assembled by all the intervening filters, or multiple pollfd items
each in their own bucket, each appended by the read.)

It would then be possible to assemble a pollset for CGI processing,
dealing with all of the intervening filters.

I think your idea is an interesting alternative, but I doubt it really
handles the breadth of these cases, so it would be an awful lot
of effort that ultimately would be undone.


View raw message