From 54bd5d385246f9c74638230b76c872736732fca7 Mon Sep 17 00:00:00 2001 From: Anton Eliasson Date: Mon, 31 Oct 2016 17:46:35 +0100 Subject: [PATCH] Support http(s)_proxy ENV variables Closes issue #65 --- lib/wayback_machine_downloader/archive_api.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/wayback_machine_downloader/archive_api.rb b/lib/wayback_machine_downloader/archive_api.rb index 70e8ff2..4f2effd 100644 --- a/lib/wayback_machine_downloader/archive_api.rb +++ b/lib/wayback_machine_downloader/archive_api.rb @@ -4,9 +4,13 @@ def get_raw_list_from_api url, page_index request_url = "http://web.archive.org/cdx/search/xd?url=" request_url += url request_url += parameters_for_api page_index - request_uri = URI.parse request_url - response = Net::HTTP.get_response request_uri - response.body + + request_uri = URI.parse request_url + Net::HTTP.new('web.archive.org', nil).start { |http| + request = Net::HTTP::Get.new request_uri + response = http.request request + response.body + } end def parameters_for_api page_index @@ -28,4 +32,4 @@ def parameters_for_api page_index parameters end -end \ No newline at end of file +end