diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-20 13:41:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-05-20 13:41:16 +0000 |
commit | b6f42822fd71c364f99f9ad817e216c2463645e6 (patch) | |
tree | 361ec445963894a5b61b1da9cea69f7ea786872d /lib/webrick/httpservlet | |
parent | 83fa035d242a01f9af5a04dc6703cecc53d936a5 (diff) |
* lib/webrick/httpservlet/filehandler.rb (set_dir_list): set charset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/httpservlet')
-rw-r--r-- | lib/webrick/httpservlet/filehandler.rb | 8 |
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_ |