httpi 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,6 +10,7 @@ module HTTPI
10
10
  #
11
11
  # * httpclient
12
12
  # * curb
13
+ # * net/http
13
14
  module Adapter
14
15
 
15
16
  # The default adapter.
@@ -79,6 +79,7 @@ module HTTPI
79
79
  client.cert_key = ssl.cert_key_file
80
80
  client.cert = ssl.cert_file
81
81
  client.cacert = ssl.ca_cert_file if ssl.ca_cert_file
82
+ client.certtype = ssl.cert_type.to_s.upcase
82
83
  client.ssl_verify_peer = ssl.verify_mode == :peer
83
84
  end
84
85
 
@@ -9,6 +9,7 @@ module HTTPI
9
9
  class SSL
10
10
 
11
11
  VERIFY_MODES = [:none, :peer, :fail_if_no_peer_cert, :client_once]
12
+ CERT_TYPES = [:pem, :der]
12
13
 
13
14
  # Returns whether SSL configuration is present.
14
15
  def present?
@@ -16,7 +17,7 @@ module HTTPI
16
17
  rescue TypeError, Errno::ENOENT
17
18
  false
18
19
  end
19
-
20
+
20
21
  # Accessor for the cert key file to validate SSL certificates.
21
22
  attr_accessor :cert_key_file
22
23
 
@@ -28,7 +29,18 @@ module HTTPI
28
29
 
29
30
  # Accessor for the cacert file to validate SSL certificates.
30
31
  attr_accessor :ca_cert_file
31
-
32
+
33
+ # Returns the cert type to validate SSL certificates PEM|DER.
34
+ def cert_type
35
+ @cert_type ||= :pem
36
+ end
37
+
38
+ # Sets the cert type to validate SSL certificates PEM|DER.
39
+ def cert_type=(type)
40
+ raise ArgumentError, "Invalid SSL cert type: #{type}" unless CERT_TYPES.include? type
41
+ @cert_type = type
42
+ end
43
+
32
44
  # Returns the SSL verify mode. Defaults to <tt>:peer</tt>.
33
45
  def verify_mode
34
46
  @verify_mode ||= :peer
@@ -1,5 +1,5 @@
1
1
  module HTTPI
2
2
 
3
- VERSION = "0.7.8"
3
+ VERSION = "0.7.9"
4
4
 
5
5
  end
@@ -199,6 +199,14 @@ describe HTTPI::Adapter::Curb do
199
199
  curb.expects(:cert_key=).with(ssl_auth_request.auth.ssl.cert_key_file)
200
200
  curb.expects(:cert=).with(ssl_auth_request.auth.ssl.cert_file)
201
201
  curb.expects(:ssl_verify_peer=).with(true)
202
+ curb.expects(:certtype=).with(ssl_auth_request.auth.ssl.cert_type.to_s.upcase)
203
+
204
+ adapter.get(ssl_auth_request)
205
+ end
206
+
207
+ it "should set the cert_type to DER if specified" do
208
+ ssl_auth_request.auth.ssl.cert_type = :der
209
+ curb.expects(:certtype=).with(:der.to_s.upcase)
202
210
 
203
211
  adapter.get(ssl_auth_request)
204
212
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 8
10
- version: 0.7.8
9
+ - 9
10
+ version: 0.7.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Harrington
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-01-08 00:00:00 +01:00
19
+ date: 2011-01-26 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency