Module: Iudex::JettyHTTPClient
- Includes:
- RJack::Jetty
- Defined in:
- lib/iudex-jetty-httpclient.rb,
lib/iudex-jetty-httpclient/base.rb
Constant Summary collapse
- VERSION =
'1.7.1'
- LIB_DIR =
:nodoc:
File.dirname( __FILE__ )
Class Method Summary collapse
Class Method Details
.create_client(opts = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/iudex-jetty-httpclient.rb', line 58 def self.create_client( opts = {} ) cfg = { :timeout => 6_000, :connect_timeout => 3_000, :idle_timeout => 6_000, :max_connections_per_destination => 2, :max_requests_queued_per_destination => 100, :dispatch_io => true, :follow_redirects => false, :max_redirects => 6, :ssl_context => { :trust_all => true } } cfg = cfg.merge( opts ) cfg = Hooker.merge( [ :iudex, :jetty_httpclient ], cfg ) timeout = cfg.delete( :timeout ) client = Client.new( create_jetty_client( cfg ) ) client.timeout = timeout if timeout client end |
.create_jetty_client(cfg = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/iudex-jetty-httpclient.rb', line 39 def self.create_jetty_client( cfg = {} ) ssl_factory = SslContextFactory.new ctx_cfg = cfg.delete( :ssl_context ) ctx_cfg.each do |key,value| ssl_factory.__send__( "set_#{key}", value ) end jclient = HttpClient.new( ssl_factory ) cfg.each do |key,value| jclient.__send__( "set_#{key}", value ) end jclient. = HttpCookieStore::Empty.new jclient end |