summaryrefslogtreecommitdiff
path: root/lib/feed2imap/httpfetcher.rb
diff options
context:
space:
mode:
authorChimrod <contact+git@chimrod.com>2011-08-30 15:47:18 +0200
committerChimrod <contact+git@chimrod.com>2011-08-30 15:47:18 +0200
commitdd474b72f01ca9ac3b431d0592cb10c19dee6415 (patch)
tree26e93517d3e38ca83aa9da83c3dcc8e10ba89967 /lib/feed2imap/httpfetcher.rb
parent5ff5b6d733136936af1789793e66d84df15731d5 (diff)
downloadfeed2imap-dd474b72f01ca9ac3b431d0592cb10c19dee6415.tar.gz
feed2imap-dd474b72f01ca9ac3b431d0592cb10c19dee6415.tar.bz2
feed2imap-dd474b72f01ca9ac3b431d0592cb10c19dee6415.zip
Set timeout for feed fetching
Diffstat (limited to 'lib/feed2imap/httpfetcher.rb')
-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
href='/portato.git/commit/portato/gui/qt/windows.py?h=0.13&id=19f9e0b5234693cf7e27a24c94f2136cd90be8c7&follow=1'>Improved masking display and made most of the Qt-Frontend worknecoro7-35/+334 2007-04-10Some more functionality for the Qt-Frontend (complete emerge)necoro8-217/+347 2007-04-07Some more functionality for the Qt-Frontendnecoro11-88/+463 2007-04-07Added Qt-Terminalnecoro4-4/+213 2007-04-06First qt draftnecoro6-1/+796 2007-04-04showed masked packages unmasked by the user similar to stable marked testing ...necoro5-13/+40 2007-03-31changed changelognecoro1-1/+2 2007-03-31Some small changes for etcproposals 1.1necoro1-2/+2 2007-03-31Some small changes for etcproposals 1.1necoro2-3/+3 2007-03-31Some small changes for etcproposals 1.1necoro1-6/+13 2007-03-31Allowed Plugins to have a menunecoro7-201/+315 2007-03-15Added etc-proposals pluginnecoro7-28/+121 2007-03-10Added USE_EXPAND-supportnecoro5-11/+63 2007-03-10Added plugin-data to about-dialognecoro3-197/+264