[Mongrel] DirHandler in surplus slashing / unrequited unescaping

Zed Shaw zedshaw at zedshaw.com
Mon Aug 7 14:12:01 EDT 2006

On Mon, 2006-08-07 at 17:03 +0000, carmen wrote:
> im using Mongrels to serve up /usr/portage/packages for other gentoo boxen. since i guess im the guinea pig with the DirHandler, ran into a couple issues:
Yep, but good timing because I'm working on the DirHandler right now.

> first, the client showed no files in the remote binhost, turns out the DirHandler was adding a trailing "/" to every filename, presumably making the client think they were directories, not files. attached is a patch which fixes this behavior..
Yeah, that was to get around how people don't add trailing slashes.  I'm
working up a fix that instead redirects to the / version, but haven't
worked out the logic yet.

I applied your patch and it all seems to work.  Grab the latest
pre-releases at:

  sudo gem install mongrel

> so now portage gets a bit further, and starts showing the normal xxxxoxxxx cache hit/miss line, and generating a lot of http traffic. eventually this fails, and mongrel stderr says:
> Mon Aug 07 12:42:02 EDT 2006: BAD CLIENT ( Invalid HTTP format, parsing fails.
> in ngrep port 80, the last request is this:
> T -> [AP]
>   GET /files/usr/portage/packages/All//gtk -2.10.1.tbz2 HTTP/1.1..Host: m..Accept-Encoding: identity..Range: bytes=-3000..
>   ..
> maybe it should only unescape this for the displayed version? eg within the <a></a>? i havent read over everything to look at the overall escaping strategy, but its what i will do for now, so that it stops mangling the filename..

Hmm, that's probably right. I'll put it in my list of bugs to fix, but
feel free to work up a patch since you're probably the most advanced
DirHandler user right now.

Zed A. Shaw
http://www.railsmachine.com/ -- Need Mongrel support?

More information about the Mongrel-users mailing list