ratom 0.6.8 → 0.6.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/History.txt +4 -0
- data/README.rdoc +4 -0
- data/VERSION.yml +1 -1
- data/lib/atom/xml/parser.rb +26 -13
- data/ratom.gemspec +2 -2
- data/spec/spec_helper.rb +4 -1
- metadata +4 -4
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -264,6 +264,10 @@ very well protected anyway.
|
|
264
264
|
|
265
265
|
As of version 0.5.1 rAtom also support authentication via HMAC request signing using the AuthHMAC[http://auth-hmac.rubyforge.org] gem. This is made available using the :hmac_access_id and :hmac_secret_key parameters which can be passed to the same methods as the HTTP Basic credentials support.
|
266
266
|
|
267
|
+
=== SSL
|
268
|
+
|
269
|
+
As of version 0.6.9, rAtom supports fetching feeds via https. This is done by using URLs with the SSL protocol. Publishing support is still limited to http, but patches are welcome.
|
270
|
+
|
267
271
|
== TODO
|
268
272
|
|
269
273
|
* Support partial content responses from the server.
|
data/VERSION.yml
CHANGED
data/lib/atom/xml/parser.rb
CHANGED
@@ -4,9 +4,11 @@
|
|
4
4
|
#
|
5
5
|
# Please visit http://www.peerworks.org/contact for further information.
|
6
6
|
#
|
7
|
-
require 'net/
|
7
|
+
require 'net/https'
|
8
8
|
require 'time'
|
9
9
|
|
10
|
+
RootCA = '/etc/ssl/certs'
|
11
|
+
|
10
12
|
# Just a couple methods form transforming strings
|
11
13
|
unless defined?(ActiveSupport)
|
12
14
|
class String # :nodoc:
|
@@ -292,21 +294,32 @@ module Atom
|
|
292
294
|
when IO
|
293
295
|
XML::Reader.io(o)
|
294
296
|
when URI
|
295
|
-
raise ArgumentError, "#{class_name}.load only handles http URIs"
|
297
|
+
raise ArgumentError, "#{class_name}.load only handles http(s) URIs" unless /http[s]?/ =~ o.scheme
|
296
298
|
response = nil
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
299
|
+
|
300
|
+
http = http = Net::HTTP.new(o.host, o.port)
|
301
|
+
|
302
|
+
http.use_ssl = (o.scheme == 'https')
|
303
|
+
if File.directory? RootCA
|
304
|
+
http.ca_path = RootCA
|
305
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
306
|
+
http.verify_depth = 5
|
307
|
+
else
|
308
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
309
|
+
end
|
310
|
+
|
311
|
+
request = Net::HTTP::Get.new(o.request_uri)
|
312
|
+
if opts[:user] && opts[:pass]
|
313
|
+
request.basic_auth(opts[:user], opts[:pass])
|
314
|
+
elsif opts[:hmac_access_id] && opts[:hmac_secret_key]
|
315
|
+
if Atom::Configuration.auth_hmac_enabled?
|
316
|
+
AuthHMAC.sign!(request, opts[:hmac_access_id], opts[:hmac_secret_key])
|
317
|
+
else
|
318
|
+
raise ArgumentError, "AuthHMAC credentials provides by auth-hmac gem is not installed"
|
307
319
|
end
|
308
|
-
response = http.request(request)
|
309
320
|
end
|
321
|
+
response = http.request(request)
|
322
|
+
|
310
323
|
case response
|
311
324
|
when Net::HTTPSuccess
|
312
325
|
XML::Reader.string(response.body)
|
data/ratom.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ratom}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Peerworks", "Sean Geoghegan"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-07-13}
|
13
13
|
s.description = %q{A fast Atom Syndication and Publication API based on libxml}
|
14
14
|
s.email = %q{seangeo@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/spec_helper.rb
CHANGED
@@ -38,6 +38,9 @@ Spec::Runner.configure do |config|
|
|
38
38
|
|
39
39
|
http = mock('http')
|
40
40
|
http.should_receive(:request).with(req).and_return(response)
|
41
|
-
|
41
|
+
http.stub!(:use_ssl=)
|
42
|
+
http.stub!(:verify_mode=)
|
43
|
+
http.stub!(:verify_depth=)
|
44
|
+
Net::HTTP.should_receive(:new).with(url.host, url.port).and_return(http)
|
42
45
|
end
|
43
46
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ratom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 9
|
10
|
+
version: 0.6.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Peerworks
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-
|
19
|
+
date: 2011-07-13 00:00:00 +09:30
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|