# File lib/mongrel/handlers.rb, line 123
123:     def can_serve(path_info)
124:       # TODO: investigate freezing the path_info to prevent double escaping
125:       req_path = File.expand_path(File.join(@path,HttpRequest.unescape(path_info)), @path)
126: 
127:       if req_path.index(@path) == 0 and File.exist? req_path
128:         # it exists and it's in the right location
129:         if File.directory? req_path
130:           # the request is for a directory
131:           index = File.join(req_path, @index_html)
132:           if File.exist? index
133:             # serve the index
134:             return index
135:           elsif @listing_allowed
136:             # serve the directory
137:             return req_path
138:           else
139:             # do not serve anything
140:             return nil
141:           end
142:         else
143:           # it's a file and it's there
144:           return req_path
145:         end
146:       else
147:         # does not exist or isn't in the right spot
148:         return nil
149:       end
150:     end