summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/feed2imap/httpfetcher.rb16
2 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e9217b8..6f15d66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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