From de037da7310f177abdb48a7229be5db949c17daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 17 Nov 2017 17:24:35 +0100 Subject: [PATCH] FIX: FinalDestination's small_get method wasn't using proper request headers --- lib/final_destination.rb | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/final_destination.rb b/lib/final_destination.rb index aa5384c660a..e7746ad931e 100644 --- a/lib/final_destination.rb +++ b/lib/final_destination.rb @@ -63,7 +63,7 @@ class FinalDestination def request_headers result = { "User-Agent" => "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36", - "Accept" => "text/html", + "Accept" => "*/*", "Host" => @uri.hostname } @@ -76,11 +76,7 @@ class FinalDestination Net::HTTP.start(@uri.host, @uri.port, use_ssl: @uri.is_a?(URI::HTTPS)) do |http| http.open_timeout = FinalDestination.connection_timeout http.read_timeout = FinalDestination.connection_timeout - - request = Net::HTTP::Get.new(@uri.request_uri, headers) - http.request(request) do |response| - return response - end + http.request_get(@uri.request_uri, headers) end end @@ -125,7 +121,7 @@ class FinalDestination @status = :resolved return @uri when 405, 406, 409, 501 - get_response = small_get(headers) + get_response = small_get(request_headers) response_status = get_response.code.to_i if response_status == 200