diff --git a/lib/atom/cache.rb b/lib/atom/cache.rb index 3234f95..06a6901 100644 --- a/lib/atom/cache.rb +++ b/lib/atom/cache.rb @@ -3,7 +3,7 @@ # # used under the terms of the MIT license -require "md5" +require "digest/md5" def normalize_header_names _headers headers = {} diff --git a/lib/atom/element.rb b/lib/atom/element.rb index e00ef1b..c34fea0 100644 --- a/lib/atom/element.rb +++ b/lib/atom/element.rb @@ -1,5 +1,6 @@ require "time" require "rexml/element" +require "uri" require 'uri' @@ -597,6 +598,10 @@ def self.parse xml, base = '' # URL absolutization if !e.base.empty? and e.href + # url-encode necessary chars + e.base = URI.escape e.base + e.href = URI.escape e.href + e.href = (e.base.to_uri + e.href).to_s end diff --git a/lib/atom/feed.rb b/lib/atom/feed.rb index 6091bfa..125e824 100644 --- a/lib/atom/feed.rb +++ b/lib/atom/feed.rb @@ -157,7 +157,7 @@ def merge other_feed # changes, new entries, &c. # # (note that this is different from Atom::Entry#updated! - def update! + def update!(check_content_type = true) raise(RuntimeError, "can't fetch without a uri.") unless @uri res = @http.get(@uri, "Accept" => "application/atom+xml") @@ -172,9 +172,11 @@ def update! end # we'll be forgiving about feed content types. - res.validate_content_type(["application/atom+xml", - "application/xml", - "text/xml"]) + if check_content_type + res.validate_content_type(["application/atom+xml", + "application/xml", + "text/xml"]) + end @etag = res["ETag"] if res["ETag"] diff --git a/lib/atom/http.rb b/lib/atom/http.rb index fd84c6b..6dbfe38 100644 --- a/lib/atom/http.rb +++ b/lib/atom/http.rb @@ -4,7 +4,7 @@ require "atom/cache" -require "sha1" +require "digest/sha1" require "digest/md5" module URI # :nodoc: all