# Mongrel 0.3.5 -- Rails/CGI Actually Works

**URL:** <https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212>\
**Category:** Ruby\
**Created:** [February 18, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212 "2006-02-18T22:10:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [February 18, 2006, 10:10pm UTC](https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212/1 "2006-02-18T22:10:37Z")

</div>

This release of Mongrel features a CGIWrapper that actually works. The  
previous code was complete garbage so this one should fix the problems  
with  
sessions, cookies, and content-types people reported previously.

There is also now a correctly built Win32 gem created by Luis L…  
Luis  
joined the Mongrel project and will be working on the Win32 specific  
gear  
needed. His first thing is going to be a Mongrel service so you can  
start/stop Mongrel like other web servers on Win32.

Grab the goods at [http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

== What Is Mongrel

Mongrel is a fast HTTP library and server for Ruby that is intended for  
hosting Ruby web applications of any kind using plain HTTP rather than  
FastCGI or SCGI. It is framework agnostic and already supports Ruby On  
Rails, Og+Nitro, and Camping frameworks.

== Changes for 0.3.5

- More correct CGIWrapper that should work with all CGI parameters and  
any  
additional ones you set as well as properly converting cookies.
- Content-types and sessions should be fixed now.
- Fix to DirHandler that caused it to not list directories if told to.

Win32 people will still have problems with CTRL-C not stopping mongrel,  
but  
Luis is tracking that down as part of his win32 service work.

== Getting Mongrel

You can get Mongrel via RubyGems just make sure you pick the win32 gem  
if  
you are on that platform. You can use the regular gem if you have your  
own  
compiler.

For those not familiar with RubyGems refer to the Mongrel site for help  
(it’s right on the front page).

== Toward 0.4

This release is getting closer to complete Ruby on Rails support. It  
should  
work well, but file upload/send will probably function very weirdly if  
at  
all.

The next release will focus on getting the win32 service working and  
enabling all the little things like file upload/send, built-in page  
caching  
support, and other goodies. People running Rails should shoot me  
feature  
requests along these lines.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [February 18, 2006, 10:28pm UTC](https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212/2 "2006-02-18T22:28:48Z")

</div>

hi Zed  
Sorry to be the bearer of bad news.

The proxy issue is still ocurring, as is the “Wrong Content-type:”  
error returned when using webservices (xmlrpc) with 0.3.5

FYI, I tried the web service request from a webrick and mongrel server  
and they both interpreted the Wrong Content-type, so the problem is not  
in the parsing of requests but the creation of responses, but maybe  
that is totally obvious 🙂

thanks for your efforts

BD

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [February 18, 2006, 10:50pm UTC](https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212/3 "2006-02-18T22:50:14Z")

</div>

Ok, let me look at the wrong content-type. Problem is that I have a  
handler  
which sets the content type just fine, so I’m thinking that the WS stuff  
must be doing something else.

The proxy stuff will still be broken until I can add a setting for “the  
real  
server”.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [February 18, 2006, 10:59pm UTC](https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212/4 "2006-02-18T22:59:18Z")

</div>

Ah yes, very clever stuff going on here in CGI land. Take a look at  
this  
dump of what is passed to the “head” method.

> > > >

head: {}  
options: {“Status”=\>“200 OK”, “type”=\>“text/xml”, “cookie”=\>[],  
“Cache-Control”=\>“no-cache”, “X-Zed”=\>“dabomb”}  
\<\<\<\<

> > > >

head: {“Status”=\>“200 OK”, “cookie”=\>[], “Cache-Control”=\>“no-cache”,  
“Server”=\>“Mongrel 0.3.5”, “Content-Type”=\>“text/xml”,  
“X-Zed”=\>“dabomb”}  
options: “text/html”  
\<\<\<\<

It’s basically a problem with both the head() and out() methods  
defaulting  
to “text/html” as their content type so it gets reset when the output is  
sent on. If you change 629 of mongrel.rb to be:

```
    @head['Content-Type'] = options unless @head['Content-Type']

```

Then that will fix it. This also means that it will default to the  
first  
content-type set. I’ll pack that up into a fix for a release tomorrow  
or  
later tonight. Let me know if that works.

Proxy stuff coming soon.

Zed A. Shaw

> **[Zed A. shaw](https://zedshaw.com/)**
>
> Personal essays and writings by Zed A. Shaw.

---

<div class="post-metadata">

**Author:** ![Zed\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/da6949/32.png) [@Zed\_S](https://www.ruby-forum.com/u/Zed_S)\
**Post date:** [February 18, 2006, 11:23pm UTC](https://www.ruby-forum.com/t/mongrel-0-3-5-rails-cgi-actually-works/70212/5 "2006-02-18T23:23:42Z")

</div>

nice one laddie!

works for me.

proxy fix and I’m all set 🙂

cheers

BD
