summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/webrick/httpservlet/filehandler.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb
index 3f609adbf5..5af3a8b362 100644
--- a/lib/webrick/httpservlet/filehandler.rb
+++ b/lib/webrick/httpservlet/filehandler.rb
@@ -437,7 +437,13 @@ module WEBrick
list.sort!{|a,b| b[idx] <=> a[idx] }
end
- res['content-type'] = "text/html"
+ type = "text/html"
+ case enc = Encoding.find('filesystem')
+ when Encoding::US_ASCII, Encoding::ASCII_8BIT
+ else
+ type << "; charset=\"#{enc.name}\""
+ end
+ res['content-type'] = type
title = "Index of #{HTMLUtils::escape(req.path)}"
res.body = <<-_end_of_html_