End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTP#read_timeout=
read_timeout=(sec)
lib/net/http.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/net/http.rb, line 1064
def read_timeout=(sec)
@socket.read_timeout = sec if @socket
@read_timeout = sec
end
Sets the read timeout, in seconds, for self to integer sec; the initial value is 60.
Argument sec must be a non-negative numeric value:
Example
http = Net::HTTP.new(hostname) http.read_timeout # => 60 http.get('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true> http.read_timeout = 0 http.get('/todos/1') # Raises Net::ReadTimeout.