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