Jeremy,

I found your old message with this title. I struck the same thing,
where the current drive wasn't the same as the drive I wanted to
serve (some) files from. So here's the patch to add to

lib/mongrel/handlers.rb contains class DirHandler. I added two
things, first to initialize:

     def initialize(path, listing_allowed=true, index_html="index.html")
       @abs = path == "/"       # Absolute paths are allowed
       @path = File.expand_path(path)
       ...

next to method can_serve, which should start with this:

     def can_serve(path_info)
       req_path = HttpRequest.unescape(path_info)
       # Add path prefix, except to absolute Windows paths:
       req_path = File.join(@path,req_path) if ([EMAIL PROTECTED] || req_path 
=~ % 
r{\a[A-Z]:[/^\\]}i)
       # Expand it to an absolute path:
       req_path = File.expand_path req_path

       if File.exist? req_path
        ....

Essentially this says if absolute paths are allowed and path_info has
a drive letter, don't add the initial path.

This should get into an official mongrel release sometime...

Clifford Heath, Data Constellation.
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to