Sha256: 2a11dd9fe84ea816083a7d8afb5c76fb4ca2e708cb9a8d8db15f42da84c561ee
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
=begin This file is part of the Arachni-RPC Pure project and may be subject to redistribution and commercial restrictions. Please see the Arachni-RPC EM web site for more information on licensing and terms of use. =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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arachni-rpc-pure-0.1.2 | lib/arachni/rpc/pure/client.rb |
arachni-rpc-pure-0.1.1 | lib/arachni/rpc/pure/client.rb |