Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add read_timeout option

  • Loading branch information...
commit 50f3cf39c9b64e91c339fa6050c6168f6ea5f9dd 1 parent 9efd04b
@chriskite authored
Showing with 14 additions and 2 deletions.
  1. +4 −2 lib/anemone/core.rb
  2. +10 −0 lib/anemone/http.rb
View
6 lib/anemone/core.rb
@@ -9,7 +9,7 @@
module Anemone
- VERSION = '0.5.0';
+ VERSION = '0.6.0';
#
# Convenience method to start a crawl
@@ -53,7 +53,9 @@ class Core
# proxy server hostname
:proxy_host => nil,
# proxy server port number
- :proxy_port => false
+ :proxy_port => false,
+ # HTTP read timeout in seconds
+ :read_timeout => nil
}
# Create setter methods for all options to be called from the crawl block
View
10 lib/anemone/http.rb
@@ -88,6 +88,13 @@ def proxy_port
@opts[:proxy_port]
end
+ #
+ # HTTP read timeout in seconds
+ #
+ def read_timeout
+ @opts[:read_timeout]
+ end
+
private
#
@@ -154,6 +161,9 @@ def connection(url)
def refresh_connection(url)
http = Net::HTTP::Proxy(proxy_host, proxy_port)
+
+ http.read_timeout = read_timeout if !!read_timeout
+
if url.scheme == 'https'
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

0 comments on commit 50f3cf3

Please sign in to comment.
Something went wrong with that request. Please try again.