Eric Hodel wrote:

> On Feb 8, 2006, at 6:18 AM, Sam Joseph wrote:
>
>> Or some interaction of the two :-)  The thing I'm really keen to  
>> work out is how the actioncontroller cgi_process.rb generates the  
>> output before the odd thingy, i.e.
>>
>> HTTP/1.x 200 OK
>> Date: Thu, 02 Feb 2006 20:56:03 GMT
>> Server: Apache/2.0.54 (Debian GNU/Linux) PHP/4.3.10-16
>>
>> Since placing a newline before any output from CgiReponse.out  places 
>> that new line after these three lines, so where are they  generated?  
>> I can't work it out.
>
> They are generated by Apache.  

Ah that makes sense.

> What do you get when you run  dispatch.cgi from the command line?

I get:

Status: 500 Internal Server Error

The only operational code I see in dispatch.cgi is Dispatcher.dispatch - 
I guess that's just passing the incoming request to the appropriate 
controller.  I guess you're saying that Apache prints the first three 
lines, and then appends the rest of the output from rails.  But 
presumably the status code needs to be communicated from rails to Apache 
- do you know how this happens?  I guess Apache cgi handler is taking the:

Status: 200 OK
Content-Type: text/html
Cache-Control: no-cache

that process_cgi.rb outputs (via dispatch.cgi) and then forms the 
complete HTTP header as a function of that.

That makes sense now.  I guess it would be nice to be able to call 
dispatch.cgi from the command line passing in the appropriate parameters 
to see exactly what it spits back ...  I tried the following:

./dispatch.cgi /discussions/tree/1
Status: 500 Internal Server Error

so it's not as simple as that.

CHEERS> SAM