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