diff options
author | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2006-05-02 12:20:07 +0000 |
---|---|---|
committer | lnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972> | 2006-05-02 12:20:07 +0000 |
commit | d12cf64a0c104b6172f0aa6ba5cc282ec3a13149 (patch) | |
tree | 82c9e67bb173d3829e10e39a8f8eacf2355b310e | |
parent | b99dd4533ac832f73b17fa4ebd560789ef54ce5a (diff) | |
download | feed2imap-d12cf64a0c104b6172f0aa6ba5cc282ec3a13149.tar.gz feed2imap-d12cf64a0c104b6172f0aa6ba5cc282ec3a13149.tar.bz2 feed2imap-d12cf64a0c104b6172f0aa6ba5cc282ec3a13149.zip |
Now handles http_proxy
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@94 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/feed2imap/httpfetcher.rb | 16 |
2 files changed, 20 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Feed2Imap 0.8 (XX/XX/2006) +============================ +* Uses the http_proxy environment variable to determine the proxy server + if available. (fixes gna bug #5820, all credits go to Boyd Adamson) + Feed2Imap 0.7 (17/02/2006) ============================ * Fixes the IMAPS disconnection problem (patch provided by Gael Utard 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 |