From d12cf64a0c104b6172f0aa6ba5cc282ec3a13149 Mon Sep 17 00:00:00 2001 From: lnu Date: Tue, 2 May 2006 12:20:07 +0000 Subject: Now handles http_proxy git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@94 f70e237a-67f3-0310-a06c-d2b8a7116972 --- lib/feed2imap/httpfetcher.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/feed2imap/httpfetcher.rb b/lib/feed2imap/httpfetcher.rb index a548b16..aab2d4e 100644 --- a/lib/feed2imap/httpfetcher.rb +++ b/lib/feed2imap/httpfetcher.rb @@ -34,7 +34,21 @@ HTTPDEBUG = false # Class used to retrieve the feed over HTTP class HTTPFetcher def HTTPFetcher::fetcher(baseuri, uri, lastcheck, recursion) - http = Net::HTTP::new(uri.host, uri.port) + proxy_host = nil + proxy_port = nil + proxy_user = nil + proxy_pass = nil + if ENV['http_proxy'] + proxy_uri = URI.parse(ENV['http_proxy']) + proxy_host = proxy_uri.host + proxy_port = proxy_uri.port + proxy_user, proxy_pass = proxy_uri.userinfo.split(/:/) if proxy_uri.userinfo + end + + http = Net::HTTP::Proxy(proxy_host, + proxy_port, + proxy_user, + proxy_pass ).new(uri.host, uri.port) if uri.scheme == 'https' http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE -- cgit v1.2.3-54-g00ecf