# File lib/mongrel.rb, line 503
503:     def send_dir_listing(base, dir, response)
504:       # take off any trailing / so the links come out right
505:       base.chop! if base[-1] == "/"[-1]
506: 
507:       if @listing_allowed
508:         response.start(200) do |head,out|
509:           head['Content-Type'] = "text/html"
510:           out << "<html><head><title>Directory Listing</title></head><body>"
511:           Dir.entries(dir).each do |child|
512:             next if child == "."
513: 
514:             if child == ".."
515:               out << "<a href=\"#{base}/#{child}\">Up to parent..</a><br/>"
516:             else
517:               out << "<a href=\"#{base}/#{child}\">#{child}</a><br/>"
518:             end
519:           end
520:           out << "</body></html>"
521:         end
522:       else
523:         response.start(403) do |head,out|
524:           out.write("Directory listings not allowed")
525:         end
526:       end
527:     end