summaryrefslogtreecommitdiff
path: root/lib/feed2imap/httpfetcher.rb
diff options
context:
space:
mode:
authorlnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972>2005-09-07 11:46:09 +0000
committerlnu <lnu@f70e237a-67f3-0310-a06c-d2b8a7116972>2005-09-07 11:46:09 +0000
commitb0ae9ddf4d34bdb76a974c55602bcb51fb3c5cc2 (patch)
treed5273b4a3d3bca41600ffb0d4043229ce61119ee /lib/feed2imap/httpfetcher.rb
parente427e2bfb53b004f2706644ed74a816a6e264c53 (diff)
downloadfeed2imap-b0ae9ddf4d34bdb76a974c55602bcb51fb3c5cc2.tar.gz
feed2imap-b0ae9ddf4d34bdb76a974c55602bcb51fb3c5cc2.tar.bz2
feed2imap-b0ae9ddf4d34bdb76a974c55602bcb51fb3c5cc2.zip
feed2imap without openssl works
git-svn-id: svn+ssh://svn.gna.org/svn/feed2imap/trunk/feed2imap@58 f70e237a-67f3-0310-a06c-d2b8a7116972
Diffstat (limited to '')
-rw-r--r--lib/feed2imap/httpfetcher.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/feed2imap/httpfetcher.rb b/lib/feed2imap/httpfetcher.rb
index 3ec69da..c72fc32 100644
--- a/lib/feed2imap/httpfetcher.rb
+++ b/lib/feed2imap/httpfetcher.rb
@@ -17,20 +17,14 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=end
-require 'feed2imap'
require 'net/http'
# get openssl if available
begin
- require 'net/https'
-rescue
+require 'net/https'
+rescue LoadError
end
require 'uri'
-if defined?(F2I_VERSION)
- USERAGENT = "Feed2Imap v#{F2I_VERSION} http://home.gna.org/feed2imap/"
-else
- USERAGENT = 'Feed2Imap http://home.gna.org/feed2imap/'
-end
# max number of redirections
MAXREDIR = 5
@@ -40,10 +34,16 @@ class HTTPFetcher
def HTTPFetcher::fetcher(baseuri, uri, lastcheck, recursion)
http = Net::HTTP::new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
+ if defined?(Feed2Imap)
+ useragent = "Feed2Imap v#{Feed2Imap.version} http://home.gna.org/feed2imap/"
+ else
+ useragent = 'Feed2Imap http://home.gna.org/feed2imap/'
+ end
+
if lastcheck == Time::at(0)
- req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => USERAGENT })
+ req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => useragent })
else
- req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => USERAGENT, 'If-Modified-Since' => lastcheck.httpdate})
+ req = Net::HTTP::Get::new(uri.request_uri, {'User-Agent' => useragent, 'If-Modified-Since' => lastcheck.httpdate})
end
if uri.userinfo
login, pw = uri.userinfo.split(':')