mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/webrick] Fix httpd error in CJK directory
[Bug #16753] https://github.com/ruby/webrick/commit/83cf440858
This commit is contained in:
parent
6742fcf553
commit
e698bf1a7f
2 changed files with 14 additions and 1 deletions
|
@ -324,7 +324,7 @@ module WEBrick
|
|||
end
|
||||
|
||||
def set_filename(req, res)
|
||||
res.filename = @root.dup
|
||||
res.filename = @root.b
|
||||
path_info = req.path_info.scan(%r|/[^/]*|)
|
||||
|
||||
path_info.unshift("") # dummy for checking @root dir
|
||||
|
|
|
@ -3,6 +3,7 @@ require "test/unit"
|
|||
require_relative "utils.rb"
|
||||
require "webrick"
|
||||
require "stringio"
|
||||
require "tmpdir"
|
||||
|
||||
class WEBrick::TestFileHandler < Test::Unit::TestCase
|
||||
def teardown
|
||||
|
@ -287,6 +288,18 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_cjk_in_path
|
||||
Dir.mktmpdir("\u3042") do |dir|
|
||||
File.write("#{dir}/\u3042.txt", "test_cjk_in_path")
|
||||
config = { :DocumentRoot => dir }
|
||||
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
req = Net::HTTP::Get.new("/%E3%81%82.txt")
|
||||
http.request(req){|res| assert_equal("200", res.code, log.call) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_script_disclosure
|
||||
return if File.executable?(__FILE__) # skip on strange file system
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue