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