lib/feedzirra/feed.rb in feedzirra-0.1.1 vs lib/feedzirra/feed.rb in feedzirra-0.1.2
- old
+ new
@@ -44,11 +44,11 @@
# Provides a list of registered feed parsing classes.
#
# === Returns
# A array of class names.
def self.feed_classes
- @feed_classes ||= [Feedzirra::Parser::RSS, Feedzirra::Parser::AtomFeedBurner, Feedzirra::Parser::Atom]
+ @feed_classes ||= [Feedzirra::Parser::RSSFeedBurner, Feedzirra::Parser::RSS, Feedzirra::Parser::AtomFeedBurner, Feedzirra::Parser::Atom]
end
# Makes all registered feeds types look for the passed in element to parse.
# This is actually just a call to element (a SAXMachine call) in the class.
#
@@ -127,10 +127,11 @@
curl.userpwd = options[:http_authentication].join(':') if options.has_key?(:http_authentication)
curl.proxy_url = options[:proxy_url] if options.has_key?(:proxy_url)
curl.proxy_port = options[:proxy_port] if options.has_key?(:proxy_port)
curl.max_redirects = options[:max_redirects] if options[:max_redirects]
curl.timeout = options[:timeout] if options[:timeout]
+ curl.ssl_verify_host = options[:ssl_verify_host] if options.has_key?(:ssl_verify_host)
curl.follow_location = true
end
# Fetches and returns the raw XML for each URL provided.
@@ -246,11 +247,11 @@
feed_queue.slice!(0, 30).each do |feed|
add_feed_to_multi(multi, feed, feed_queue, responses, options)
end
multi.perform
- responses.size == 1 ? responses.values.first : responses.values
+ responses.is_a?(Array)? responses.values : responses.values.first
end
# An abstraction for adding a feed by URL to the passed Curb::multi stack.
#
# === Parameters
@@ -323,9 +324,10 @@
# The updated Curl::Multi object with the request details added to it's stack.
def self.add_feed_to_multi(multi, feed, feed_queue, responses, options)
easy = Curl::Easy.new(feed.feed_url) do |curl|
setup_easy curl, options
curl.headers["If-Modified-Since"] = feed.last_modified.httpdate if feed.last_modified
+ curl.headers["If-Modified-Since"] = options[:if_modified_since] if options[:if_modified_since] && (!feed.last_modified || (Time.parse(options[:if_modified_since].to_s) > feed.last_modified))
curl.headers["If-None-Match"] = feed.etag if feed.etag
curl.on_success do |c|
begin
add_feed_to_multi(multi, feed_queue.shift, feed_queue, responses, options) unless feed_queue.empty?
\ No newline at end of file