Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/TAGS
/doc
/pkg
.idea
7 changes: 7 additions & 0 deletions lib/net/http/persistent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ def self.detect_idle_timeout uri, max = 10

attr_accessor :read_timeout

##
# Seconds to wait until writing one block. See Net::HTTP#write_timeout

attr_accessor :write_timeout

##
# By default SSL sessions are reused to avoid extra SSL handshakes. Set
# this to false if you have problems communicating with an HTTPS server
Expand Down Expand Up @@ -530,6 +535,7 @@ def initialize name: nil, proxy: nil, pool_size: DEFAULT_POOL_SIZE
@keep_alive = 30
@open_timeout = nil
@read_timeout = nil
@write_timeout = nil
@idle_timeout = 5
@max_requests = nil
@socket_options = []
Expand Down Expand Up @@ -643,6 +649,7 @@ def connection_for uri
end

http.read_timeout = @read_timeout if @read_timeout
http.write_timeout = @write_timeout if @write_timeout && http.respond_to?(:write_timeout=)
http.keep_alive_timeout = @idle_timeout if @idle_timeout

return yield connection
Expand Down