httpi 0.7.8 → 0.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/httpi/adapter.rb +1 -0
- data/lib/httpi/adapter/curb.rb +1 -0
- data/lib/httpi/auth/ssl.rb +14 -2
- data/lib/httpi/version.rb +1 -1
- data/spec/httpi/adapter/curb_spec.rb +8 -0
- metadata +4 -4
data/lib/httpi/adapter.rb
CHANGED
data/lib/httpi/adapter/curb.rb
CHANGED
data/lib/httpi/auth/ssl.rb
CHANGED
@@ -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
|
data/lib/httpi/version.rb
CHANGED
@@ -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:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 0.7.
|
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-
|
19
|
+
date: 2011-01-26 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|