diff options
author | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2020-06-19 22:47:08 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2020-06-19 22:56:29 +0900 |
commit | 97c1782db634ab0344fbc829477897d5de034475 (patch) | |
tree | 0a78db9a4b7480422945cdfcaceec342cfc7b5c1 /test/webrick | |
parent | 78d4eace02c3c03b65d775a3bb7537f2a6e8c6e7 (diff) | |
download | ruby-97c1782db634ab0344fbc829477897d5de034475.tar.gz |
Use filesystem encoding as FileHandler's encoding
instead of `@root.encoding`.
And fallback to ASCII-8BIT when filesystem encoding is US-ASCII.
When `@root.encoding` is not compatible filesystem encoding,
`Encoding::CompatibilityError` raised at `webrick/httpservlet/filehandler.rb:341`.
So `DocumentRoot` must be compatible with filesystem encoding.
Diffstat (limited to 'test/webrick')
-rw-r--r-- | test/webrick/test_filehandler.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index 758ec7f589..d6fa4e2f15 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -291,6 +291,11 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase def test_cjk_in_path Dir.mktmpdir("\u3042") do |dir| File.write("#{dir}/\u3042.txt", "test_cjk_in_path") + begin + dir = dir.encode('filesystem') + rescue EncodingError + dir = dir.b + end config = { :DocumentRoot => dir } TestWEBrick.start_httpserver(config) do |server, addr, port, log| http = Net::HTTP.new(addr, port) |