Mongrel Patch - Fixes 404 Error in IE

Hello,

Using Mongrel has been great. Thank you Zed for developing such a fine
piece
of software.

For some reason, when using IE to access a Rails app running on a
Mongrel
server, I get a 404 error. This is an intermittent error and does not
happen
on all machines.

Upon further investigation, we noticed that IE sends a
GET http://localhost:3000/path/to/file
instead of
GET /path/to/file

This causes Mongrel to send back a 404, without sending the request to
Rails. It seems the GET http://localhost:3000/path/to/file does not map
to
the proper handler.

We looked in the RFC (section 5.2),
HTTP/1.1: Request, and it seems to
indicate that the web server should ignore the host part of an absolute
uri
in the GET request. Am I correct on this?

I created a bug report at
http://rubyforge.org/tracker/index.php?func=detail&aid=5053&group_id=1306&atid=5145
and a patch to fix it at
http://rubyforge.org/tracker/index.php?func=detail&aid=5190&group_id=1306&atid=5147

Has this been an issue for anybody else?

Zed or anybody on the Mongrel core team, if you see this, please take a
look
at the patch.
http://rubyforge.org/tracker/index.php?func=detail&aid=5190&group_id=1306&atid=5147

Thanks,
Brian T.

On Wed, 2006-07-26 at 16:25 +0900, Brian T. wrote:

Zed or anybody on the Mongrel core team, if you see this, please take a look
at the patch.
http://rubyforge.org/tracker/index.php?func=detail&aid=5190&group_id=1306&atid=5147

Brian, I’ve been watching your patch and bug reports but haven’t had
time to deal with them just yet. Next week I’ll be attacking the bug
list and doing a release.

BTW, your patch has a potential buffer overflow in two directions.
There’s a simpler fix I’ll do in the parser, but use your patch to get
you over the hump until I make it. Basically, strstr and then searching
for a “/” without any sizes will cause nasty things.

Also, Mongrel doesn’t really recognize URLs like this since it’s not
doing vhosts or anything, so the real question is why IE is sending this
crap. I’ll add the patch since frankly you can’t fight IE, but there’s
got to be a reason IE is sending this. I use IE in testing all the
time and never had this happen.

Maybe it’s that stupid localhost:3000 vs. http://localhost:3000 thing
(try typing both into IE and see if one works but the other doesn’t)?

Zed

Thank you Zed!!