mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/open-uri: Test server log in server thread.
* test/webrick: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0d07bc203c
commit
ad58f04833
8 changed files with 203 additions and 169 deletions
|
@ -165,8 +165,13 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
|||
|
||||
def test_non_disclosure_name
|
||||
config = { :DocumentRoot => File.dirname(__FILE__), }
|
||||
log_tester = lambda {|log, access_log|
|
||||
log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
|
||||
log = log.reject {|s| /WARN the request refers nondisclosure name/ =~ s }
|
||||
assert_equal([], log)
|
||||
}
|
||||
this_file = File.basename(__FILE__)
|
||||
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
|
||||
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
doc_root_opts = server[:DocumentRootOptions]
|
||||
doc_root_opts[:NondisclosureName] = %w(.ht* *~ test_*)
|
||||
|
@ -189,7 +194,12 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
|||
|
||||
def test_directory_traversal
|
||||
config = { :DocumentRoot => File.dirname(__FILE__), }
|
||||
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
|
||||
log_tester = lambda {|log, access_log|
|
||||
log = log.reject {|s| /ERROR bad URI/ =~ s }
|
||||
log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
|
||||
assert_equal([], log)
|
||||
}
|
||||
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
req = Net::HTTP::Get.new("/../../")
|
||||
http.request(req){|res| assert_equal("400", res.code, log.call) }
|
||||
|
@ -217,7 +227,12 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
|||
:DocumentRoot => File.dirname(__FILE__),
|
||||
:CGIPathEnv => ENV['PATH'],
|
||||
}
|
||||
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
|
||||
log_tester = lambda {|log, access_log|
|
||||
log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
|
||||
log = log.reject {|s| /WARN the request refers nondisclosure name/ =~ s }
|
||||
assert_equal([], log)
|
||||
}
|
||||
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
if windows?
|
||||
fname = nil
|
||||
|
@ -260,7 +275,11 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase
|
|||
end
|
||||
},
|
||||
}
|
||||
TestWEBrick.start_httpserver(config) do |server, addr, port, log|
|
||||
log_tester = lambda {|log, access_log|
|
||||
log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
|
||||
assert_equal([], log)
|
||||
}
|
||||
TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
|
||||
http = Net::HTTP.new(addr, port)
|
||||
|
||||
req = Net::HTTP::Get.new("/webrick.cgi/test")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue