summaryrefslogtreecommitdiff
path: root/lib/feed2imap/httpfetcher.rb
diff options
context:
space:
mode:
authorLucas Nussbaum <lucas@lucas-nussbaum.net>2012-04-26 10:21:33 +0200
committerLucas Nussbaum <lucas@lucas-nussbaum.net>2012-04-26 10:21:33 +0200
commitc8c32eea5d329773bda8ce0a073266ab498507c5 (patch)
tree1f6bd5bf62b826c51ed7912e9e7f3c3c5bf70694 /lib/feed2imap/httpfetcher.rb
parent04db76a10d2f26e124731f7601722bfa2de61dfe (diff)
parentd3ac1f64a5ba90d755e58bd0f3ff2813baca510b (diff)
downloadfeed2imap-c8c32eea5d329773bda8ce0a073266ab498507c5.tar.gz
feed2imap-c8c32eea5d329773bda8ce0a073266ab498507c5.tar.bz2
feed2imap-c8c32eea5d329773bda8ce0a073266ab498507c5.zip
Merge remote-tracking branch 'chimrod/master'
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/httpfetcher.rb17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/feed2imap/httpfetcher.rb b/lib/feed2imap/httpfetcher.rb
index 9980578..6734465 100644
--- a/lib/feed2imap/httpfetcher.rb
+++ b/lib/feed2imap/httpfetcher.rb
@@ -34,7 +34,14 @@ HTTPDEBUG = false
# Class used to retrieve the feed over HTTP
class HTTPFetcher
- def HTTPFetcher::fetcher(baseuri, uri, lastcheck, recursion)
+
+ @timeout = 30 # should be enough for everybody...
+
+ def timeout=(value)
+ @timeout = value
+ end
+
+ def fetcher(baseuri, uri, lastcheck, recursion)
proxy_host = nil
proxy_port = nil
proxy_user = nil
@@ -50,8 +57,8 @@ class HTTPFetcher
proxy_port,
proxy_user,
proxy_pass ).new(uri.host, uri.port)
- http.read_timeout = 30 # should be enough for everybody...
- http.open_timeout = 30
+ http.read_timeout = @timeout
+ http.open_timeout = @timeout
if uri.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -108,8 +115,8 @@ class HTTPFetcher
end
end
- def HTTPFetcher::fetch(url, lastcheck)
+ def fetch(url, lastcheck)
uri = URI::parse(url)
- return HTTPFetcher::fetcher(uri, uri, lastcheck, MAXREDIR)
+ return fetcher(uri, uri, lastcheck, MAXREDIR)
end
end