savon 2.0.1 → 2.0.2
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/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/lib/savon/options.rb +25 -0
- data/lib/savon/request.rb +26 -3
- data/lib/savon/version.rb +1 -1
- data/spec/fixtures/ssl/client_cert.pem +16 -0
- data/spec/fixtures/ssl/client_key.pem +15 -0
- data/spec/integration/ratp_example_spec.rb +0 -14
- data/spec/savon/options_spec.rb +57 -6
- metadata +6 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 2.0.2 (2012-12-20)
|
2
|
+
|
3
|
+
* Fix: [#297](https://github.com/savonrb/savon/issues/297#issuecomment-11536517) added the global
|
4
|
+
`:ssl_verify_mode` and `:ssl_version` options which were missing.
|
5
|
+
|
6
|
+
* Fix: [#344](https://github.com/savonrb/savon/issues/344) added missing global ssl cert options
|
7
|
+
`:ssl_cert_file`, `:ssl_cert_key_file` and `:ssl_ca_cert_file`.
|
8
|
+
|
1
9
|
## 2.0.1 (2012-12-19)
|
2
10
|
|
3
11
|
* Fix [#342](https://github.com/savonrb/savon/issues/342) fixes an issue where namespaces could
|
data/Gemfile
CHANGED
data/lib/savon/options.rb
CHANGED
@@ -180,6 +180,31 @@ module Savon
|
|
180
180
|
@options[:last_response] = last_response
|
181
181
|
end
|
182
182
|
|
183
|
+
# Specifies the SSL version to use.
|
184
|
+
def ssl_version(version)
|
185
|
+
@options[:ssl_version] = version
|
186
|
+
end
|
187
|
+
|
188
|
+
# Whether and how to to verify the connection.
|
189
|
+
def ssl_verify_mode(verify_mode)
|
190
|
+
@options[:ssl_verify_mode] = verify_mode
|
191
|
+
end
|
192
|
+
|
193
|
+
# Sets the cert key file to use.
|
194
|
+
def ssl_cert_key_file(file)
|
195
|
+
@options[:ssl_cert_key_file] = file
|
196
|
+
end
|
197
|
+
|
198
|
+
# Sets the cert file to use.
|
199
|
+
def ssl_cert_file(file)
|
200
|
+
@options[:ssl_cert_file] = file
|
201
|
+
end
|
202
|
+
|
203
|
+
# Sets the ca cert file to use.
|
204
|
+
def ssl_ca_cert_file(file)
|
205
|
+
@options[:ssl_ca_cert_file] = file
|
206
|
+
end
|
207
|
+
|
183
208
|
# HTTP basic auth credentials.
|
184
209
|
def basic_auth(*credentials)
|
185
210
|
@options[:basic_auth] = credentials.flatten
|
data/lib/savon/request.rb
CHANGED
@@ -36,22 +36,45 @@ module Savon
|
|
36
36
|
|
37
37
|
def create_http_client
|
38
38
|
http = HTTPI::Request.new
|
39
|
-
http.url = @globals[:endpoint] || @wsdl.endpoint
|
40
39
|
|
40
|
+
configure_request(http)
|
41
|
+
configure_timeouts(http)
|
42
|
+
configure_headers(http)
|
43
|
+
configure_ssl(http)
|
44
|
+
configure_auth(http)
|
45
|
+
|
46
|
+
http
|
47
|
+
end
|
48
|
+
|
49
|
+
def configure_request(http)
|
50
|
+
http.url = @globals[:endpoint] || @wsdl.endpoint
|
41
51
|
http.proxy = @globals[:proxy] if @globals.include? :proxy
|
42
52
|
http.set_cookies @globals[:last_response] if @globals.include? :last_response
|
53
|
+
end
|
43
54
|
|
55
|
+
def configure_timeouts(http)
|
44
56
|
http.open_timeout = @globals[:open_timeout] if @globals.include? :open_timeout
|
45
57
|
http.read_timeout = @globals[:read_timeout] if @globals.include? :read_timeout
|
58
|
+
end
|
46
59
|
|
60
|
+
def configure_headers(http)
|
47
61
|
http.headers = @globals[:headers] if @globals.include? :headers
|
48
62
|
http.headers["SOAPAction"] ||= %{"#{soap_action}"} if soap_action
|
49
63
|
http.headers["Content-Type"] = CONTENT_TYPE[@globals[:soap_version]] % @globals[:encoding]
|
64
|
+
end
|
50
65
|
|
66
|
+
def configure_ssl(http)
|
67
|
+
http.auth.ssl.ssl_version = @globals[:ssl_version] if @globals.include? :ssl_version
|
68
|
+
http.auth.ssl.verify_mode = @globals[:ssl_verify_mode] if @globals.include? :ssl_verify_mode
|
69
|
+
|
70
|
+
http.auth.ssl.cert_key_file = @globals[:ssl_cert_key_file] if @globals.include? :ssl_cert_key_file
|
71
|
+
http.auth.ssl.cert_file = @globals[:ssl_cert_file] if @globals.include? :ssl_cert_file
|
72
|
+
http.auth.ssl.ca_cert_file = @globals[:ssl_ca_cert_file] if @globals.include? :ssl_ca_cert_file
|
73
|
+
end
|
74
|
+
|
75
|
+
def configure_auth(http)
|
51
76
|
http.auth.basic(*@globals[:basic_auth]) if @globals.include? :basic_auth
|
52
77
|
http.auth.digest(*@globals[:digest_auth]) if @globals.include? :digest_auth
|
53
|
-
|
54
|
-
http
|
55
78
|
end
|
56
79
|
|
57
80
|
def soap_action
|
data/lib/savon/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIICbTCCAdYCCQDC4v8d04615DANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJE
|
3
|
+
RTEQMA4GA1UECBMHSGFtYnVyZzEQMA4GA1UEBxMHSGFtYnVyZzEOMAwGA1UEChMF
|
4
|
+
aHR0cGkxFDASBgNVBAMTC2V4YW1wbGUuY29tMSIwIAYJKoZIhvcNAQkBFhNleGFt
|
5
|
+
cGxlQGV4YW1wbGUuY29tMB4XDTEwMTAxNTE4NTg0N1oXDTExMTAxNTE4NTg0N1ow
|
6
|
+
ezELMAkGA1UEBhMCREUxEDAOBgNVBAgTB0hhbWJ1cmcxEDAOBgNVBAcTB0hhbWJ1
|
7
|
+
cmcxDjAMBgNVBAoTBWh0dHBpMRQwEgYDVQQDEwtleGFtcGxlLmNvbTEiMCAGCSqG
|
8
|
+
SIb3DQEJARYTZXhhbXBsZUBleGFtcGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOB
|
9
|
+
jQAwgYkCgYEAvJiaojIFQAbFczXkBmjxpxra9LbQm0VIESFSl8uBSjmG/gmCBwKg
|
10
|
+
8O94P3tAjDNClC+fEqBLE37KH4qe76yw7upgRruP5jQzUEL1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1cAIhp9GvxooeveOtaCkRpxcC48ToIbHrLI4oyrfoHECQQC6
|
12
|
+
bAHtmz6TMp5ka2j7Yez1EIC5WiQ/WxyTukgsi5V1YOX35B2jfPEf2SGxTE6BOBSb
|
13
|
+
lnxRBPqRpkoIiwiZ9OgBAkBOWKBuHXmXM6wr+0p4KQ/DOeStZiBxUT8rYbX/i1BI
|
14
|
+
/9Xo48KNerTx7qoDK+jIslDrilahvcwUz0fuVV7rHy/X
|
15
|
+
-----END RSA PRIVATE KEY-----
|
@@ -16,20 +16,6 @@ describe "RATP example" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
response = client.call(:get_stations) do
|
19
|
-
# For the corrent values to pass for :from_unit and :to_unit, I searched the WSDL for
|
20
|
-
# the "FromUnit" type which is a "TemperatureUnit" enumeration that looks like this:
|
21
|
-
#
|
22
|
-
# <s:simpleType name="TemperatureUnit">
|
23
|
-
# <s:restriction base="s:string">
|
24
|
-
# <s:enumeration value="degreeCelsius"/>
|
25
|
-
# <s:enumeration value="degreeFahrenheit"/>
|
26
|
-
# <s:enumeration value="degreeRankine"/>
|
27
|
-
# <s:enumeration value="degreeReaumur"/>
|
28
|
-
# <s:enumeration value="kelvin"/>
|
29
|
-
# </s:restriction>
|
30
|
-
# </s:simpleType>
|
31
|
-
#
|
32
|
-
# Support for XS schema types needs to be improved.
|
33
19
|
message(:station => { :id => 1975 }, :limit => 1)
|
34
20
|
end
|
35
21
|
|
data/spec/savon/options_spec.rb
CHANGED
@@ -75,18 +75,18 @@ describe "Options" do
|
|
75
75
|
|
76
76
|
context "global :encoding" do
|
77
77
|
it "changes the XML instruction" do
|
78
|
-
client = new_client(:endpoint => @server.url(:repeat), :encoding => "
|
78
|
+
client = new_client(:endpoint => @server.url(:repeat), :encoding => "ISO-8859-1")
|
79
79
|
response = client.call(:authenticate)
|
80
80
|
|
81
|
-
expect(response.http.body).to match(/<\?xml version="1\.0" encoding="
|
81
|
+
expect(response.http.body).to match(/<\?xml version="1\.0" encoding="ISO-8859-1"\?>/)
|
82
82
|
end
|
83
83
|
|
84
84
|
it "changes the Content-Type header" do
|
85
|
-
client = new_client(:endpoint => @server.url(:inspect_header), :encoding => "
|
85
|
+
client = new_client(:endpoint => @server.url(:inspect_header), :encoding => "ISO-8859-1",
|
86
86
|
:headers => { "Inspect" => "CONTENT_TYPE" })
|
87
87
|
|
88
88
|
response = client.call(:authenticate)
|
89
|
-
expect(response.http.body).to eq("text/xml;charset=
|
89
|
+
expect(response.http.body).to eq("text/xml;charset=ISO-8859-1")
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -255,6 +255,54 @@ describe "Options" do
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
+
context "global :ssl_version" do
|
259
|
+
it "sets the SSL version to use" do
|
260
|
+
HTTPI::Auth::SSL.any_instance.expects(:ssl_version=).with(:SSLv3)
|
261
|
+
|
262
|
+
client = new_client(:endpoint => @server.url, :ssl_version => :SSLv3)
|
263
|
+
client.call(:authenticate)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
context "global :ssl_verify_mode" do
|
268
|
+
it "sets the verify mode to use" do
|
269
|
+
HTTPI::Auth::SSL.any_instance.expects(:verify_mode=).with(:none)
|
270
|
+
|
271
|
+
client = new_client(:endpoint => @server.url, :ssl_verify_mode => :none)
|
272
|
+
client.call(:authenticate)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
context "global :ssl_cert_key_file" do
|
277
|
+
it "sets the cert key file to use" do
|
278
|
+
cert_key = File.expand_path("../../fixtures/ssl/client_key.pem", __FILE__)
|
279
|
+
HTTPI::Auth::SSL.any_instance.expects(:cert_key_file=).with(cert_key)
|
280
|
+
|
281
|
+
client = new_client(:endpoint => @server.url, :ssl_cert_key_file => cert_key)
|
282
|
+
client.call(:authenticate)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
context "global :ssl_cert_file" do
|
287
|
+
it "sets the cert file to use" do
|
288
|
+
cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
289
|
+
HTTPI::Auth::SSL.any_instance.expects(:cert_file=).with(cert)
|
290
|
+
|
291
|
+
client = new_client(:endpoint => @server.url, :ssl_cert_file => cert)
|
292
|
+
client.call(:authenticate)
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
context "global :ssl_ca_cert_file" do
|
297
|
+
it "sets the ca cert file to use" do
|
298
|
+
ca_cert = File.expand_path("../../fixtures/ssl/client_cert.pem", __FILE__)
|
299
|
+
HTTPI::Auth::SSL.any_instance.expects(:ca_cert_file=).with(ca_cert)
|
300
|
+
|
301
|
+
client = new_client(:endpoint => @server.url, :ssl_ca_cert_file => ca_cert)
|
302
|
+
client.call(:authenticate)
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
258
306
|
context "global :basic_auth" do
|
259
307
|
it "sets the basic auth credentials" do
|
260
308
|
client = new_client(:endpoint => @server.url(:basic_auth), :basic_auth => ["admin", "secret"])
|
@@ -410,7 +458,7 @@ describe "Options" do
|
|
410
458
|
end
|
411
459
|
|
412
460
|
response = client.call(:find_user) do |locals|
|
413
|
-
locals.message(user_name
|
461
|
+
locals.message(:user_name => "luke", "pass_word" => "secret")
|
414
462
|
end
|
415
463
|
|
416
464
|
request = response.http.body
|
@@ -486,7 +534,10 @@ describe "Options" do
|
|
486
534
|
context "request :message" do
|
487
535
|
it "accepts a Hash which is passed to Gyoku to be converted to XML" do
|
488
536
|
response = new_client(:endpoint => @server.url(:repeat)).call(:authenticate, :message => { :user => "luke", :password => "secret" })
|
489
|
-
|
537
|
+
|
538
|
+
request = response.http.body
|
539
|
+
expect(request).to include("<user>luke</user>")
|
540
|
+
expect(request).to include("<password>secret</password>")
|
490
541
|
end
|
491
542
|
|
492
543
|
it "also accepts a String of raw XML" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: savon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nori
|
@@ -248,6 +248,8 @@ files:
|
|
248
248
|
- spec/fixtures/response/soap_fault.xml
|
249
249
|
- spec/fixtures/response/soap_fault12.xml
|
250
250
|
- spec/fixtures/response/taxcloud.xml
|
251
|
+
- spec/fixtures/ssl/client_cert.pem
|
252
|
+
- spec/fixtures/ssl/client_key.pem
|
251
253
|
- spec/fixtures/wsdl/authentication.xml
|
252
254
|
- spec/fixtures/wsdl/lower_camel.xml
|
253
255
|
- spec/fixtures/wsdl/multiple_namespaces.xml
|
@@ -290,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
292
|
version: '0'
|
291
293
|
segments:
|
292
294
|
- 0
|
293
|
-
hash:
|
295
|
+
hash: 2724646448334842614
|
294
296
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
297
|
none: false
|
296
298
|
requirements:
|
@@ -299,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
301
|
version: '0'
|
300
302
|
segments:
|
301
303
|
- 0
|
302
|
-
hash:
|
304
|
+
hash: 2724646448334842614
|
303
305
|
requirements: []
|
304
306
|
rubyforge_project: savon
|
305
307
|
rubygems_version: 1.8.24
|