lib/down/net_http.rb in down-5.4.0 vs lib/down/net_http.rb in down-5.4.1

- old
+ new

@@ -268,11 +268,11 @@ http.open_timeout = options[:open_timeout] if options.key?(:open_timeout) headers = options[:headers].to_h headers["Accept-Encoding"] = "" # Net::HTTP's inflater causes FiberErrors - get = Net::HTTP::Get.new(uri.request_uri, headers) + get = Net::HTTP::Get.new(uri, headers) user, password = options[:http_basic_authentication] || [uri.user, uri.password] get.basic_auth(user, password) if user || password [http, get] @@ -310,16 +310,17 @@ # When open-uri raises an exception, it doesn't expose the response object. # Fortunately, the exception object holds response data that can be used to # rebuild the Net::HTTP response object. def rebuild_response_from_open_uri_exception(exception) code, message = exception.io.status + message ||= "Unknown" response_class = Net::HTTPResponse::CODE_TO_OBJ.fetch(code) do |c| Net::HTTPResponse::CODE_CLASS_TO_OBJ.fetch(c[0]) do Net::HTTPUnknownResponse end end - response = response_class.new(nil, code, message) + response = response_class.new(nil, code, message) exception.io.metas.each do |name, values| values.each { |value| response.add_field(name, value) } end