Skip to content
Merged
Changes from 1 commit
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
18 changes: 16 additions & 2 deletions lib/net/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def HTTP.post_form(url, params)
# \HTTP session management
#

# Returns intger +80+, the default port to use for \HTTP requests:
# Returns integer +80+, the default port to use for \HTTP requests:
#
# Net::HTTP.default_port # => 80
#
Expand Down Expand Up @@ -1048,7 +1048,21 @@ def read_timeout=(sec)
# Sets the write timeout, in seconds, for +self+ to integer +sec+;
# the initial value is 60.
#
# Argument +sec+ must be a non-negative numeric value.
# Argument +sec+ must be a non-negative numeric value:
#
# _uri = uri.dup
# _uri.path = '/posts'
# body = 'bar' * 200000
# data = <<EOF
# {"title": "foo", "body": "#{body}", "userId": "1"}
# EOF
# headers = {'content-type': 'application/json'}
# http = Net::HTTP.new(hostname)
# http.post(_uri.path, data, headers)
# # => #<Net::HTTPCreated 201 Created readbody=true>
# http.write_timeout = 0
# http.post(_uri.path, data, headers)
# # => #<Net::HTTPCreated 201 Created readbody=true>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my machine, this example raises a Net::WriteTimeout.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have edited here in place.

#
def write_timeout=(sec)
@socket.write_timeout = sec if @socket
Expand Down