Sha256: 1b04b2f531a810ca6ec1207527a34026de4dd5b949fa11d62f5eee4b0d989182
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
=begin Arachni-RPC Copyright (c) 2011 Tasos "Zapotek" Laskos <tasos.laskos@gmail.com> This is free software; you can copy and distribute and modify this program under the term of the GPL v2.0 License (See LICENSE file for details) =end module Arachni module RPC module Pure class Client def initialize( opts ) @opts = opts end def call( msg, *args ) conn = nil begin conn = Connection.new( @opts ) rescue OpenSSL::SSL::SSLError => ex e = Arachni::RPC::Exceptions::SSLPeerVerificationFailed.new( ex.to_s ) e.set_backtrace( ex.backtrace ) raise e rescue Errno::ECONNREFUSED => ex e = Arachni::RPC::Exceptions::ConnectionError.new( ex.to_s ) e.set_backtrace( ex.backtrace ) raise e end response = conn.perform( request( msg, *args ) ) conn.close handle_exception( response ) return response.obj end private def handle_exception( response ) if exception?( response ) raise Arachni::RPC::Exceptions.from_response( response ) end end def exception?( response ) response.obj.is_a?( Hash ) && response.obj.include?( 'exception' ) end def request( msg, *args ) Request.new( :message => msg, :args => args, :token => @opts[:token] ) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arachni-rpc-pure-0.1 | lib/arachni/rpc/pure/client.rb |