lib/onebox/helpers.rb in onebox-1.8.10 vs lib/onebox/helpers.rb in onebox-1.8.11
- old
+ new
@@ -37,12 +37,13 @@
end
og
end
- def self.fetch_response(location, limit=5, domain=nil, headers=nil)
+ def self.fetch_response(location, limit=nil, domain=nil, headers=nil)
+ limit ||= 5
limit = Onebox.options.redirect_limit if limit > Onebox.options.redirect_limit
raise Net::HTTPError.new('HTTP redirect too deep', location) if limit == 0
uri = URI(location)
@@ -68,10 +69,10 @@
size_bytes = Onebox.options.max_download_kb * 1024
http.request(request) do |response|
if cookie = response.get_fields('set-cookie')
- header = { 'cookie' => cookie.join }
+ header = { 'Cookie' => cookie.join }
end
header = nil unless header.is_a? Hash
code = response.code.to_i