# File lib/mongrel.rb, line 478 478: def can_serve(path_info) 479: req = File.expand_path(File.join(@path,path_info), @path) 480: 481: if req.index(@path) == 0 and File.exist? req 482: # it exists and it's in the right location 483: if File.directory? req 484: # the request is for a directory 485: index = File.join(req, @index_html) 486: if File.exist? index 487: # serve the index 488: return index 489: elsif @listing_allows 490: # serve the directory 491: req 492: else 493: # do not serve anything 494: return nil 495: end 496: else 497: # it's a file and it's there 498: return req 499: end 500: else 501: # does not exist or isn't in the right spot 502: return nil 503: end 504: end