diff options
author | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-28 14:43:47 +0000 |
---|---|---|
committer | evanweaver <evanweaver@19e92222-5c0b-0410-8929-a290d50e31e9> | 2007-10-28 14:43:47 +0000 |
commit | eee31c293bc107334ac2ac7704dc44d1f1c43863 (patch) | |
tree | 9b41dc58d51414319ad280e149a2634f52961652 /lib/mongrel | |
parent | a15a0431a98a0723a9aec45fdd9ea53ccb114eda (diff) | |
download | unicorn-eee31c293bc107334ac2ac7704dc44d1f1c43863.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@817 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'lib/mongrel')
-rw-r--r-- | lib/mongrel/handlers.rb | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/mongrel/handlers.rb b/lib/mongrel/handlers.rb index 385f958..499d69f 100644 --- a/lib/mongrel/handlers.rb +++ b/lib/mongrel/handlers.rb @@ -126,29 +126,27 @@ module Mongrel def can_serve(path_info) req_path = HttpRequest.unescape(path_info) - if @path - req_path = File.expand_path(File.join(@path, path_info), @path) - else - req_path = File.expand_path(req_path) - end - - if req_path.index(@path) == 0 and File.exist? req_path - # it exists and it's in the right location + # Add the drive letter or root path + req_path = File.join(@path, req_path) if @path + req_path = File.expand_path req_path + + if File.exist? req_path + # It exists and it's in the right location if File.directory? req_path - # the request is for a directory + # The request is for a directory index = File.join(req_path, @index_html) if File.exist? index - # serve the index + # Serve the index return index elsif @listing_allowed - # serve the directory + # Serve the directory return req_path else - # do not serve anything + # Do not serve anything return nil end else - # it's a file and it's there + # It's a file and it's there return req_path end else |