# File lib/mongrel/handlers.rb, line 155
155:     def send_dir_listing(base, dir, response)
156:       # take off any trailing / so the links come out right
157:       base = HttpRequest.unescape(base)
158:       base.chop! if base[-1] == "/"[-1]
159: 
160:       if @listing_allowed
161:         response.start(200) do |head,out|
162:           head[Const::CONTENT_TYPE] = "text/html"
163:           out << "<html><head><title>Directory Listing</title></head><body>"
164:           Dir.entries(dir).each do |child|
165:             next if child == "."
166:             out << "<a href=\"#{base}/#{ HttpRequest.escape(child)}\">"
167:             out << (child == ".." ? "Up to parent.." : child)
168:             out << "</a><br/>"
169:           end
170:           out << "</body></html>"
171:         end
172:       else
173:         response.start(403) do |head,out|
174:           out.write("Directory listings not allowed")
175:         end
176:       end
177:     end