diff options
Diffstat (limited to 'test/xmlrpc/test_webrick_server.rb')
-rw-r--r-- | test/xmlrpc/test_webrick_server.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb index 36d64d5093..bc102390c3 100644 --- a/test/xmlrpc/test_webrick_server.rb +++ b/test/xmlrpc/test_webrick_server.rb @@ -11,19 +11,19 @@ module TestXMLRPC class Test_Webrick < Test::Unit::TestCase include WEBrick_Testing - @@basic_auth = WEBrick::HTTPAuth::BasicAuth.new( - :Realm => 'auth', - :UserDB => WEBrick::HTTPAuth::Htpasswd.new(File.expand_path('./htpasswd', File.dirname(__FILE__))), - :Logger => NoLog, - ) - - def create_servlet + def create_servlet(server) s = XMLRPC::WEBrickServlet.new - def s.service(req, res) - @@basic_auth.authenticate(req, res) + basic_auth = WEBrick::HTTPAuth::BasicAuth.new( + :Realm => 'auth', + :UserDB => WEBrick::HTTPAuth::Htpasswd.new(File.expand_path('./htpasswd', File.dirname(__FILE__))), + :Logger => server.logger, + ) + + class << s; self end.send(:define_method, :service) {|req, res| + basic_auth.authenticate(req, res) super(req, res) - end + } s.add_handler("test.add") do |a,b| a + b @@ -68,7 +68,7 @@ class Test_Webrick < Test::Unit::TestCase # NOTE: I don't enable SSL testing as this hangs [false].each do |use_ssl| option = setup_http_server_option(use_ssl) - with_server(option, create_servlet) {|addr| + with_server(option, method(:create_servlet)) {|addr| @s = XMLRPC::Client.new3(:host => addr.ip_address, :port => addr.ip_port, :use_ssl => use_ssl) @s.user = 'admin' @s.password = 'admin' |