httpi 2.4.0 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +3 -5
  3. data/CHANGELOG.md +42 -0
  4. data/Gemfile +5 -1
  5. data/README.md +7 -7
  6. data/Rakefile +5 -3
  7. data/httpi.gemspec +2 -1
  8. data/lib/httpi.rb +5 -4
  9. data/lib/httpi/adapter.rb +1 -1
  10. data/lib/httpi/adapter/curb.rb +18 -5
  11. data/lib/httpi/adapter/em_http.rb +5 -4
  12. data/lib/httpi/adapter/excon.rb +16 -5
  13. data/lib/httpi/adapter/http.rb +88 -0
  14. data/lib/httpi/adapter/httpclient.rb +15 -4
  15. data/lib/httpi/adapter/net_http.rb +43 -16
  16. data/lib/httpi/adapter/net_http_persistent.rb +10 -1
  17. data/lib/httpi/adapter/rack.rb +13 -6
  18. data/lib/httpi/auth/ssl.rb +49 -2
  19. data/lib/httpi/logger.rb +6 -1
  20. data/lib/httpi/request.rb +12 -5
  21. data/lib/httpi/response.rb +2 -0
  22. data/lib/httpi/version.rb +1 -1
  23. data/spec/httpi/adapter/curb_spec.rb +56 -18
  24. data/spec/httpi/adapter/em_http_spec.rb +21 -13
  25. data/spec/httpi/adapter/excon_spec.rb +28 -90
  26. data/spec/httpi/adapter/http_spec.rb +28 -0
  27. data/spec/httpi/adapter/httpclient_spec.rb +39 -4
  28. data/spec/httpi/adapter/net_http_persistent_spec.rb +31 -81
  29. data/spec/httpi/adapter/net_http_spec.rb +39 -99
  30. data/spec/httpi/adapter/rack_spec.rb +6 -8
  31. data/spec/httpi/auth/ssl_spec.rb +32 -1
  32. data/spec/httpi/httpi_spec.rb +17 -1
  33. data/spec/httpi/request_spec.rb +5 -0
  34. data/spec/integration/curb_spec.rb +11 -0
  35. data/spec/integration/em_http_spec.rb +17 -0
  36. data/spec/integration/excon_spec.rb +165 -0
  37. data/spec/integration/http_spec.rb +147 -0
  38. data/spec/integration/httpclient_spec.rb +11 -0
  39. data/spec/integration/net_http_persistent_spec.rb +22 -1
  40. data/spec/integration/net_http_spec.rb +127 -1
  41. data/spec/integration/support/application.rb +4 -2
  42. metadata +35 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7fdb3bb23a9cba076a235fac76aa7aa0aa04a803
4
- data.tar.gz: 7740630503dc0ffedc3f909f1418d45f0a443156
2
+ SHA256:
3
+ metadata.gz: d4ef171693207d4179542cd91eb6de5c8a1dc4b30458fcb5e255098e60a6297e
4
+ data.tar.gz: fb6977168d9ad78ab44fdfcbce528145fbe4c43f433a195cd6cd1ca5e33f1f54
5
5
  SHA512:
6
- metadata.gz: 14a720954983eecb0fd4497f2c0e87269ceb5373c0856e19d4de9b7a102c7adba108e8fb44b020a80dc038b820355efffff9dfcdf0dad94f24668953c4d9b38d
7
- data.tar.gz: 5f8119a473f8daf6c7dfd597a172002ead1f5b1fceea7456c083e14a9daee93da63d23a7018030103389a3397ae9e6df986780e032a7612f5d39a482b3619f5c
6
+ metadata.gz: fb1092a0fb53a39f2d7f327b0f7c02b914f8f1e1f80f20e64178592d81b98d414016a62310a532931c3ba0da969f9fde269da22ea62fb594220f111a351e64ba
7
+ data.tar.gz: 5ce7bd00cb3ed67cace0e21ca2a4b459f6da89d618da1857b641a37413a0da98b5619b617dd86fab0a68ba280713a24d4ab54ae6b44362b91c3bc04df43a9e3a
@@ -1,8 +1,6 @@
1
1
  language: "ruby"
2
2
  script: "bundle exec rake ci"
3
3
  rvm:
4
- - 1.9.3
5
- - 2.0
6
- - 2.1
7
- - 2.2
8
- - jruby-19mode
4
+ - 2.5.8
5
+ - 2.6.6
6
+ - 2.7.1
@@ -1,3 +1,45 @@
1
+ ### 2.4.5
2
+
3
+ * Improvement: [#209](https://github.com/savonrb/httpi/pull/209) Drop Travis CI support for Ruby < 2.3.0 and jruby.
4
+ * Feature: [#208](https://github.com/savonrb/httpi/pull/208) Add SSL min/max_version configuration for supporting adapters
5
+ * Improvement: [#206](https://github.com/savonrb/httpi/pull/206) Support for net-http-persistent v3
6
+ * Improvement: [#204](https://github.com/savonrb/httpi/pull/204) Avoid excon warning
7
+
8
+ ### 2.4.4
9
+
10
+ * Improvement: [#197](https://github.com/savonrb/httpi/pull/197) Add support for new write timeout option to all adapters
11
+ * Fix: [#196](https://github.com/savonrb/httpi/pull/196) Fix httpi adapters support for read/open timeout
12
+ * Improvement: [Remove references to broken site](https://github.com/savonrb/httpi/commit/345e5e2b1a4376a7be769f67088a431895de09ad)
13
+ * Fix: [#190](https://github.com/savonrb/httpi/pull/190) Don't convert port to string on Excon adapter
14
+
15
+ ### 2.4.3
16
+
17
+ * Fix: [#171](https://github.com/savonrb/httpi/pull/171) bug with rubyntlm v0.6.0
18
+ * Fix: [#181](https://github.com/savonrb/httpi/pull/181) excon and http adapters
19
+ * Feature: [#183](https://github.com/savonrb/httpi/pull/183) Logging ssl information of a request
20
+ * Fix: [#187](https://github.com/savonrb/httpi/pull/187) only require ntlm if ntlm auth was requested
21
+
22
+
23
+ ### 2.4.2
24
+
25
+ * Feature: [#165](https://github.com/savonrb/httpi/pull/165) Extended net_http adapter ssl options with cert_store and ca_path
26
+ * Improvement: [#166](https://github.com/savonrb/httpi/pull/166) fix some warnings
27
+ * Feature: [#167](https://github.com/savonrb/httpi/pull/167) adds missing support for cert password
28
+ * Feature: [#163](https://github.com/savonrb/httpi/pull/163) Support HTTP Basic auth in Rack adapter
29
+ * Fix: [#162](https://github.com/savonrb/httpi/pull/162) fixing excon adapter to pass client_cert and key as strings instead of objects
30
+ * Fix: [#160](https://github.com/savonrb/httpi/pull/160) httpclient adapter now accepts NTLM auth
31
+ * Improvement: [#158](https://github.com/savonrb/httpi/pull/158) Limit the maximum of redirects to prevent infinite redirects
32
+ * Improvement: [#153](https://github.com/savonrb/httpi/pull/153) Dynamically determine methods Net::HTTP supports
33
+ * Improvement: [#155](https://github.com/savonrb/httpi/pull/155) Enable socks proxy server specification
34
+ * Improvement: [#151](https://github.com/savonrb/httpi/pull/151) Fix excon verify mode
35
+ * Fix: [#149](https://github.com/savonrb/httpi/pull/149) Ensure that header exists before accessing it
36
+
37
+ ### 2.4.1
38
+
39
+ * Fix: [#147](https://github.com/savonrb/httpi/pull/147) Fix call Curb client "SSL peer certificate or SSH remote key was not OK" bug
40
+ * Feature: [#145](https://github.com/savonrb/httpi/pull/145) Add support to http.rb adapter
41
+ * Feature: [#144](https://github.com/savonrb/httpi/pull/144) Add NTLM support for CURB
42
+
1
43
  ### 2.4.0
2
44
 
3
45
  * Formally drop support for ruby 1.8.7
data/Gemfile CHANGED
@@ -3,13 +3,17 @@ gemspec
3
3
 
4
4
  gem 'jruby-openssl', :platforms => :jruby
5
5
 
6
+ # compatibility restrictions for http clients under existing travis test environments
7
+ gem 'public_suffix', '~> 2.0' # or remove rubies < 2.1 from travis.yml
8
+
6
9
  # http clients
7
10
  gem 'httpclient', '~> 2.3', :require => false
8
11
  gem 'curb', '~> 0.8', :require => false, :platforms => :ruby
9
12
  gem 'em-http-request', :require => false, :platforms => [:ruby, :jruby]
10
13
  gem 'em-synchrony', :require => false, :platforms => [:ruby, :jruby]
11
- gem 'excon', '~> 0.21.0', :require => false, :platforms => [:ruby, :jruby]
14
+ gem 'excon', '~> 0.21', :require => false, :platforms => [:ruby, :jruby]
12
15
  gem 'net-http-persistent', '~> 2.8', :require => false
16
+ gem 'http', :require => false
13
17
 
14
18
  # coverage
15
19
  gem 'simplecov', :require => false
data/README.md CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  A common interface for Ruby's HTTP libraries.
4
4
 
5
- [Documentation](http://httpirb.com) | [RDoc](http://rubydoc.info/gems/httpi) |
5
+ [Documentation](https://www.rubydoc.info/gems/httpi) |
6
6
  [Mailing list](https://groups.google.com/forum/#!forum/httpirb)
7
7
 
8
- [![Build Status](https://secure.travis-ci.org/savonrb/httpi.png?branch=master)](http://travis-ci.org/savonrb/httpi)
9
- [![Gem Version](https://badge.fury.io/rb/httpi.png)](http://badge.fury.io/rb/httpi)
10
- [![Code Climate](https://codeclimate.com/github/savonrb/httpi.png)](https://codeclimate.com/github/savonrb/httpi)
11
- [![Coverage Status](https://coveralls.io/repos/savonrb/httpi/badge.png?branch=master)](https://coveralls.io/r/savonrb/httpi)
8
+ [![Build Status](https://secure.travis-ci.org/savonrb/httpi.svg?branch=master)](http://travis-ci.org/savonrb/httpi)
9
+ [![Gem Version](https://badge.fury.io/rb/httpi.svg)](http://badge.fury.io/rb/httpi)
10
+ [![Code Climate](https://codeclimate.com/github/savonrb/httpi.svg)](https://codeclimate.com/github/savonrb/httpi)
11
+ [![Coverage Status](https://coveralls.io/repos/savonrb/httpi/badge.svg?branch=master)](https://coveralls.io/r/savonrb/httpi)
12
12
 
13
13
 
14
14
  ## Installation
15
15
 
16
- HTTPI is available through [Rubygems](http://rubygems.org/gems/httpi) and can be installed via:
16
+ HTTPI is available through [Rubygems](https://rubygems.org/gems/httpi) and can be installed via:
17
17
 
18
18
  ```
19
19
  $ gem install httpi
@@ -52,4 +52,4 @@ HTTPI.request(:custom, request)
52
52
 
53
53
  ## Documentation
54
54
 
55
- Continue reading at [httpirb.com](http://httpirb.com)
55
+ Continue reading at https://www.rubydoc.info/gems/httpi
data/Rakefile CHANGED
@@ -10,7 +10,9 @@ RSpec::Core::RakeTask.new "spec_integration" do |t|
10
10
  t.pattern = "spec/integration/*_spec.rb"
11
11
  end
12
12
 
13
- task :default => :spec
14
-
15
13
  desc "Run RSpec code and integration examples"
16
- task :ci => [:spec, :spec_integration]
14
+ RSpec::Core::RakeTask.new "ci" do |t|
15
+ t.pattern = "spec/{httpi,integration}/**/*_spec.rb"
16
+ end
17
+
18
+ task :default => :spec
@@ -13,16 +13,17 @@ Gem::Specification.new do |s|
13
13
  s.description = s.summary
14
14
  s.required_ruby_version = '>= 1.9.2'
15
15
 
16
- s.rubyforge_project = s.name
17
16
  s.license = 'MIT'
18
17
 
19
18
  s.add_dependency 'rack'
19
+ s.add_dependency 'socksify'
20
20
 
21
21
  s.add_development_dependency 'rubyntlm', '~> 0.3.2'
22
22
  s.add_development_dependency 'rake', '~> 10.0'
23
23
  s.add_development_dependency 'rspec', '~> 2.14'
24
24
  s.add_development_dependency 'mocha', '~> 0.13'
25
25
  s.add_development_dependency 'puma', '~> 2.3.2'
26
+ s.add_development_dependency 'webmock'
26
27
 
27
28
  s.files = `git ls-files`.split("\n")
28
29
  s.require_path = 'lib'
@@ -11,6 +11,7 @@ require "httpi/adapter/net_http"
11
11
  require "httpi/adapter/net_http_persistent"
12
12
  require "httpi/adapter/em_http"
13
13
  require "httpi/adapter/rack"
14
+ require "httpi/adapter/http"
14
15
 
15
16
  # = HTTPI
16
17
  #
@@ -102,7 +103,7 @@ module HTTPI
102
103
  class << self
103
104
 
104
105
  def query_builder
105
- @query_builder || HTTPI::QueryBuilder::Flat
106
+ @query_builder ||= HTTPI::QueryBuilder::Flat
106
107
  end
107
108
 
108
109
  def query_builder=(builder)
@@ -151,7 +152,7 @@ module HTTPI
151
152
  end
152
153
 
153
154
  # Executes an HTTP request for the given +method+.
154
- def request(method, request, adapter = nil)
155
+ def request(method, request, adapter = nil, redirects = 0)
155
156
  adapter_class = load_adapter(adapter, request)
156
157
 
157
158
  yield adapter_class.client if block_given?
@@ -159,10 +160,10 @@ module HTTPI
159
160
 
160
161
  response = adapter_class.request(method)
161
162
 
162
- if response && HTTPI::Response::RedirectResponseCodes.member?(response.code) && request.follow_redirect?
163
+ if response && HTTPI::Response::RedirectResponseCodes.member?(response.code) && request.follow_redirect? && redirects < request.redirect_limit
163
164
  request.url = URI.join(request.url, response.headers['location'])
164
165
  log("Following redirect: '#{request.url}'.")
165
- return request(method, request, adapter)
166
+ return request(method, request, adapter, redirects + 1)
166
167
  end
167
168
 
168
169
  response
@@ -13,7 +13,7 @@ module HTTPI
13
13
  ADAPTERS = {}
14
14
  ADAPTER_CLASS_MAP = {}
15
15
 
16
- LOAD_ORDER = [:httpclient, :curb, :em_http, :excon, :net_http, :net_http_persistent]
16
+ LOAD_ORDER = [:httpclient, :curb, :em_http, :excon, :http, :net_http, :net_http_persistent]
17
17
 
18
18
  class << self
19
19
 
@@ -59,10 +59,11 @@ module HTTPI
59
59
  def setup_client
60
60
  basic_setup
61
61
 
62
- if @request.auth.ntlm?
63
- raise NotSupportedError, "curb does not support NTLM authentication"
62
+ if @request.auth.ntlm? && !Curl.ntlm?
63
+ raise NotSupportedError, "installed version of libcurl does not support NTLM authentication"
64
64
  end
65
65
 
66
+ setup_ntlm_auth if @request.auth.ntlm?
66
67
  setup_http_auth if @request.auth.http?
67
68
  setup_gssnegotiate_auth if @request.auth.gssnegotiate?
68
69
  setup_ssl_auth if @request.auth.ssl? || @request.ssl?
@@ -71,8 +72,9 @@ module HTTPI
71
72
  def basic_setup
72
73
  @client.url = @request.url.to_s
73
74
  @client.proxy_url = @request.proxy.to_s if @request.proxy
74
- @client.timeout = @request.read_timeout if @request.read_timeout
75
- @client.connect_timeout = @request.open_timeout if @request.open_timeout
75
+ read_or_write_timeout = @request.read_timeout || @request.write_timeout
76
+ @client.timeout_ms = read_or_write_timeout * 1000 if read_or_write_timeout
77
+ @client.connect_timeout_ms = @request.open_timeout * 1000 if @request.open_timeout
76
78
  @client.headers = @request.headers.to_hash
77
79
  @client.verbose = false
78
80
  # cURL workaround
@@ -81,6 +83,11 @@ module HTTPI
81
83
  @client.set(:NOSIGNAL, true)
82
84
  end
83
85
 
86
+ def setup_ntlm_auth
87
+ @client.http_auth_types = @request.auth.type
88
+ @client.username, @client.password = *@request.auth.credentials
89
+ end
90
+
84
91
  def setup_http_auth
85
92
  @client.http_auth_types = @request.auth.type
86
93
  @client.username, @client.password = *@request.auth.credentials
@@ -98,7 +105,9 @@ module HTTPI
98
105
  ssl = @request.auth.ssl
99
106
 
100
107
  if @request.auth.ssl?
101
- unless ssl.verify_mode == :none
108
+ if ssl.verify_mode == :none
109
+ @client.ssl_verify_host = 0
110
+ else
102
111
  @client.cacert = ssl.ca_cert_file if ssl.ca_cert_file
103
112
  @client.certtype = ssl.cert_type.to_s.upcase
104
113
  end
@@ -106,6 +115,7 @@ module HTTPI
106
115
  # Send client-side certificate regardless of state of SSL verify mode
107
116
  @client.cert_key = ssl.cert_key_file
108
117
  @client.cert = ssl.cert_file
118
+ @client.certpassword = ssl.cert_key_password
109
119
 
110
120
  @client.ssl_verify_peer = ssl.verify_mode == :peer
111
121
  end
@@ -118,6 +128,9 @@ module HTTPI
118
128
  when :SSLv23 then 2
119
129
  when :SSLv3 then 3
120
130
  end
131
+ if ssl.min_version || ssl.max_version
132
+ raise NotSupportedError, 'Curb adapter does not support #min_version or #max_version. Please, use #ssl_version instead.'
133
+ end
121
134
  end
122
135
 
123
136
  def respond_with(client)
@@ -69,10 +69,11 @@ module HTTPI
69
69
  end
70
70
 
71
71
  def connection_options
72
- options = {
73
- :connect_timeout => @request.open_timeout,
74
- :inactivity_timeout => @request.read_timeout
75
- }
72
+ options = {}
73
+
74
+ read_or_write_timeout = @request.read_timeout || @request.write_timeout
75
+ options[:inactivity_timeout] = read_or_write_timeout if read_or_write_timeout
76
+ options[:connect_timeout] = @request.open_timeout if @request.open_timeout
76
77
 
77
78
  options[:proxy] = proxy_options if @request.proxy
78
79
 
@@ -41,8 +41,9 @@ module HTTPI
41
41
 
42
42
  opts = {
43
43
  :host => url.host,
44
+ :hostname => url.hostname,
44
45
  :path => url.path,
45
- :port => url.port.to_s,
46
+ :port => url.port,
46
47
  :query => url.query,
47
48
  :scheme => url.scheme,
48
49
  :headers => @request.headers,
@@ -58,23 +59,33 @@ module HTTPI
58
59
  opts[:user], opts[:password] = *@request.auth.credentials if @request.auth.basic?
59
60
  opts[:connect_timeout] = @request.open_timeout if @request.open_timeout
60
61
  opts[:read_timeout] = @request.read_timeout if @request.read_timeout
62
+ opts[:write_timeout] = @request.write_timeout if @request.write_timeout
61
63
  opts[:response_block] = @request.on_body if @request.on_body
62
64
  opts[:proxy] = @request.proxy if @request.proxy
63
65
 
64
- if ssl.verify_mode == :peer
66
+ case ssl.verify_mode
67
+ when :peer
65
68
  opts[:ssl_verify_peer] = true
66
69
  opts[:ssl_ca_file] = ssl.ca_cert_file if ssl.ca_cert_file
67
- opts[:client_cert] = ssl.cert if ssl.cert
68
- opts[:client_key] = ssl.cert_key if ssl.cert_key
70
+ opts[:certificate] = ssl.cert.to_pem if ssl.cert
71
+ opts[:private_key] = ssl.cert_key.to_pem if ssl.cert_key
72
+ when :none
73
+ opts[:ssl_verify_peer] = false
69
74
  end
70
75
 
71
76
  opts[:ssl_version] = ssl.ssl_version if ssl.ssl_version
77
+ opts[:ssl_min_version] = ssl.min_version if ssl.min_version
78
+ opts[:ssl_max_version] = ssl.max_version if ssl.max_version
72
79
 
73
80
  opts
74
81
  end
75
82
 
76
83
  def respond_with(response)
77
- Response.new response.status, response.headers, response.body
84
+ headers = response.headers.dup
85
+ if (cookies = response.data[:cookies]) && !cookies.empty?
86
+ headers["Set-Cookie"] = cookies
87
+ end
88
+ Response.new response.status, headers, response.body
78
89
  end
79
90
 
80
91
  end
@@ -0,0 +1,88 @@
1
+ require "httpi/adapter/base"
2
+ require "httpi/response"
3
+
4
+ module HTTPI
5
+ module Adapter
6
+
7
+ # = HTTPI::Adapter::HTTP
8
+ #
9
+ # Adapter for the http.rb client.
10
+ # https://github.com/httprb/http.rb
11
+ class HTTP < Base
12
+
13
+ register :http, :deps => %w(http)
14
+
15
+ def initialize(request)
16
+ if request.auth.digest?
17
+ raise NotSupportedError, "http.rb does not support HTTP digest authentication"
18
+ end
19
+ if request.auth.ntlm?
20
+ raise NotSupportedError, "http.rb does not support NTLM digest authentication"
21
+ end
22
+
23
+ @request = request
24
+ @client = create_client
25
+ end
26
+
27
+ attr_reader :client
28
+
29
+ # Executes arbitrary HTTP requests.
30
+ # @see HTTPI.request
31
+ def request(method)
32
+ unless ::HTTP::Request::METHODS.include? method
33
+ raise NotSupportedError, "http.rb does not support custom HTTP methods"
34
+ end
35
+ response = begin
36
+ @client.send(method, @request.url, :body => @request.body)
37
+ rescue OpenSSL::SSL::SSLError
38
+ raise SSLError
39
+ end
40
+
41
+ Response.new(response.code, response.headers.to_h, response.body.to_s)
42
+ end
43
+
44
+ private
45
+
46
+ def create_client
47
+ if @request.ssl?
48
+ context = OpenSSL::SSL::SSLContext.new
49
+
50
+ context.options = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options]
51
+
52
+ if @request.auth.ssl.ca_cert_file != nil
53
+ context.ca_file = @request.auth.ssl.ca_cert_file
54
+ else
55
+ context.cert_store = OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
56
+ end
57
+
58
+ context.cert = @request.auth.ssl.cert
59
+ context.key = @request.auth.ssl.cert_key
60
+ context.ssl_version = @request.auth.ssl.ssl_version if @request.auth.ssl.ssl_version != nil
61
+ context.min_version = @request.auth.ssl.min_version if @request.auth.ssl.min_version != nil
62
+ context.max_version = @request.auth.ssl.max_version if @request.auth.ssl.max_version != nil
63
+ context.verify_mode = @request.auth.ssl.openssl_verify_mode
64
+
65
+ client = ::HTTP::Client.new(:ssl_context => context)
66
+ else
67
+ client = ::HTTP
68
+ end
69
+
70
+ if @request.auth.basic?
71
+ client = client.basic_auth(:user => @request.auth.credentials[0], :pass => @request.auth.credentials[1])
72
+ end
73
+
74
+ if @request.proxy != nil
75
+ client = client.via(@request.proxy.host, @request.proxy.port, @request.proxy.user, @request.proxy.password)
76
+ end
77
+
78
+ timeouts = {}
79
+ timeouts[:connect] = @request.open_timeout if @request.open_timeout
80
+ timeouts[:read] = @request.read_timeout if @request.read_timeout
81
+ timeouts[:write] = @request.write_timeout if @request.write_timeout
82
+ client = client.timeout(timeouts) if timeouts.any?
83
+
84
+ client.headers(@request.headers)
85
+ end
86
+ end
87
+ end
88
+ end
@@ -36,11 +36,8 @@ module HTTPI
36
36
  def setup_client
37
37
  basic_setup
38
38
 
39
- if @request.auth.ntlm?
40
- raise NotSupportedError, "HTTPClient adapter does not support NTLM authentication"
41
- end
42
-
43
39
  setup_auth if @request.auth.http?
40
+ setup_ntlm_auth if @request.auth.ntlm?
44
41
  setup_ssl_auth if @request.auth.ssl? || @request.ssl?
45
42
  end
46
43
 
@@ -48,12 +45,23 @@ module HTTPI
48
45
  @client.proxy = @request.proxy if @request.proxy
49
46
  @client.connect_timeout = @request.open_timeout if @request.open_timeout
50
47
  @client.receive_timeout = @request.read_timeout if @request.read_timeout
48
+ @client.send_timeout = @request.write_timeout if @request.write_timeout
51
49
  end
52
50
 
53
51
  def setup_auth
54
52
  @client.set_auth @request.url, *@request.auth.credentials
55
53
  end
56
54
 
55
+ def setup_ntlm_auth
56
+ username, password, domain = @request.auth.credentials
57
+
58
+ unless domain.nil?
59
+ username = "#{domain.upcase}\\#{username}"
60
+ end
61
+
62
+ @client.set_auth @request.url, username, password
63
+ end
64
+
57
65
  def setup_ssl_auth
58
66
  ssl = @request.auth.ssl
59
67
 
@@ -70,6 +78,9 @@ module HTTPI
70
78
  end
71
79
 
72
80
  @client.ssl_config.ssl_version = ssl.ssl_version.to_s if ssl.ssl_version
81
+ if ssl.min_version || ssl.max_version
82
+ raise NotSupportedError, 'Httpclient adapter does not support #min_version or #max_version. Please, use #ssl_version instead'
83
+ end
73
84
  end
74
85
 
75
86
  def respond_with(response)