From 750203c514e0e9a49f7d53fb54084e6844fca42a Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 18 Jun 2020 23:42:02 +0900 Subject: lib/webrick/httpservlet/filehandler.rb: always handle a path as UTF-8 https://rubyci.org/logs/mswinci.japaneast.cloudapp.azure.com/vc12-x64/ruby-master/log/20200618T113134Z.fail.html.gz ``` 1) Failure: WEBrick::TestFileHandler#test_cjk_in_path [D:/tmp/mswin-build20200618-84004-1t0dh8f/ruby/test/webrick/utils.rb:72]: exceptions on 2 threads: webrick log start: [2020-06-18 22:18:07] ERROR `/??.txt' not found. webrick log end Filesystem encoding is Windows-31J. <"200"> expected but was <"404">. ``` --- test/webrick/test_filehandler.rb | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'test/webrick/test_filehandler.rb') diff --git a/test/webrick/test_filehandler.rb b/test/webrick/test_filehandler.rb index ff75f07c53..edf0d8b12c 100644 --- a/test/webrick/test_filehandler.rb +++ b/test/webrick/test_filehandler.rb @@ -294,16 +294,7 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase config = { :DocumentRoot => dir } TestWEBrick.start_httpserver(config) do |server, addr, port, log| http = Net::HTTP.new(addr, port) - filesystem_path = "\u3042" - case Encoding.find('filesystem') - when Encoding::US_ASCII, Encoding::ASCII_8BIT - else - begin - filesystem_path = "\u3042".encode("filesystem") - rescue Encoding::UndefinedConversionError - end - end - req = Net::HTTP::Get.new("/#{ filesystem_path.bytes.map {|b| "%%%X" % b }.join }.txt") + req = Net::HTTP::Get.new("/%E3%81%82.txt") http.request(req){|res| assert_equal("200", res.code, log.call + "\nFilesystem encoding is #{Encoding.find('filesystem')}") } end end -- cgit v1.2.1