# Cgi.rb

**URL:** <https://www.ruby-forum.com/t/cgi-rb/79203>\
**Category:** Ruby\
**Created:** [November 29, 2005, 8:44pm UTC](https://www.ruby-forum.com/t/cgi-rb/79203 "2005-11-29T20:44:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akonsu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@akonsu](https://www.ruby-forum.com/u/akonsu)\
**Post date:** [November 29, 2005, 8:44pm UTC](https://www.ruby-forum.com/t/cgi-rb/79203/1 "2005-11-29T20:44:37Z")

</div>

Hello,

i am looking at cgi.rb module, and it looks like it produces valid HTTP  
responses such as

HTTP/1.1 404 Not Found  
Date: Tue, 29 Nov 2005 06:52:21 GMT\r\n  
Content-Length: 0\r\n  
Connection: close\r\n  
Content-Type: text/html\r\n  
\r\n  
…

what i expected it to produce is CGI headers so that the web server (I  
am using Apache) could interpret the CGI response correctly and act on  
it:

Status: 404 Not Found\r\n  
Content-Type: text/html\r\n  
\r\n  
…

has anyone used cgi.rb? i know rails, nitro etc use it. has anyone  
noticed this? can this be controlled?

thanks  
konstantin

---

<div class="post-metadata">

**Author:** ![akonsu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/13edae/32.png) [@akonsu](https://www.ruby-forum.com/u/akonsu)\
**Post date:** [November 29, 2005, 9:45pm UTC](https://www.ruby-forum.com/t/cgi-rb/79203/2 "2005-11-29T21:45:41Z")

</div>

> noticed this? can this be controlled?  
> Are you setting “nph” =\> true when calling CGI#out or CGI#header? If  
> you  
> are, you probably don’t want to. I believe that controls whether or not  
> the  
> HTTP version and response are printed (among other variables like  
> whether  
> you’re using mod\_ruby or IIS). See line 559 of cgi.rb in a Ruby  
> 1.8.2distro for details.

Cheers,  
/Nick
