From e6b62964d5ce1508d867bec513cc76a0e4bd026b Mon Sep 17 00:00:00 2001 From: nahi Date: Tue, 21 Dec 2004 15:08:56 +0000 Subject: * lib/soap/*, test/soap/*, sample/soap/authheader/*: eval cleanup. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/soap/authheader/server2.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'sample/soap/authheader/server2.rb') diff --git a/sample/soap/authheader/server2.rb b/sample/soap/authheader/server2.rb index b0065e314..8a0eaafc8 100644 --- a/sample/soap/authheader/server2.rb +++ b/sample/soap/authheader/server2.rb @@ -6,10 +6,6 @@ require 'authmgr' class AuthHeaderPortServer < SOAP::RPC::StandaloneServer class AuthHeaderService - def self.create - new - end - def initialize(authmgr) @authmgr = authmgr end @@ -34,14 +30,20 @@ class AuthHeaderPortServer < SOAP::RPC::StandaloneServer Name = 'http://tempuri.org/authHeaderPort' def initialize(*arg) super - add_rpc_servant(AuthHeaderService.new, Name) - ServerAuthHeaderHandler.init + authmgr = Authmgr.new + add_rpc_servant(AuthHeaderService.new(authmgr), Name) + ServerAuthHeaderHandler.init(authmgr) + # header handler must be a per request handler. add_rpc_request_headerhandler(ServerAuthHeaderHandler) end class ServerAuthHeaderHandler < SOAP::Header::SimpleHandler MyHeaderName = XSD::QName.new("http://tempuri.org/authHeader", "auth") + def self.init(authmgr) + @authmgr = authmgr + end + def self.create new(@authmgr) end @@ -63,7 +65,7 @@ class AuthHeaderPortServer < SOAP::RPC::StandaloneServer if sessionid = my_header["sessionid"] if userid = @authmgr.auth(sessionid) @authmgr.destroy_session(sessionid) - @session_id = @authmgr.create_session(userid) + @sessionid = @authmgr.create_session(userid) auth = true end end @@ -73,5 +75,9 @@ class AuthHeaderPortServer < SOAP::RPC::StandaloneServer end if $0 == __FILE__ - status = AuthHeaderPortServer.new('AuthHeaderPortServer', nil, '0.0.0.0', 7000).start + svr = AuthHeaderPortServer.new('AuthHeaderPortServer', nil, '0.0.0.0', 7000) + trap(:INT) do + svr.shutdown + end + status = svr.start end -- cgit