lib/feedzirra/feed.rb in feedzirra-0.2.2 vs lib/feedzirra/feed.rb in feedzirra-0.3.0
- old
+ new
@@ -111,24 +111,35 @@
# Setup curl from options.
# Possible parameters:
# * :user_agent - overrides the default user agent.
# * :compress - any value to enable compression
- # * :http_authentication - array containing http authentication parameters
+ # * :enable_cookies - boolean
+ # * :cookiefile - file to read cookies
+ # * :cookies - contents of cookies header
+ # * :http_authentication - array containing username, then password
# * :proxy_url - proxy url
# * :proxy_port - proxy port
# * :max_redirects - max number of redirections
# * :timeout - timeout
- def self.setup_easy curl, options
+ # * :ssl_verify_host - boolean
+ # * :ssl_verify_peer - boolean
+ # * :ssl_version - the ssl version to use, see OpenSSL::SSL::SSLContext::METHODS for options
+ def self.setup_easy(curl, options={})
curl.headers["Accept-encoding"] = 'gzip, deflate' if options.has_key?(:compress)
curl.headers["User-Agent"] = (options[:user_agent] || USER_AGENT)
+ curl.enable_cookies = options[:enable_cookies] if options.has_key?(:enable_cookies)
+ curl.cookiefile = options[:cookiefile] if options.has_key?(:cookiefile)
+ curl.cookies = options[:cookies] if options.has_key?(:cookies)
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.ssl_verify_peer = options[:ssl_verify_peer] if options.has_key?(:ssl_verify_peer)
+ curl.ssl_version = options[:ssl_version] if options.has_key?(:ssl_version)
curl.follow_location = true
end
# Fetches and returns the raw XML for each URL provided.