summaryrefslogtreecommitdiff
path: root/test/net
diff options
context:
space:
mode:
authorJeremy Evans <[email protected]>2021-03-01 12:59:21 -0800
committergit <[email protected]>2022-04-20 10:22:06 +0900
commit90ccc5674affb64036ca86f566c8650f654fc0f6 ()
tree0d18cee05d0ba91778b48dc818b6477b076eb6c2 /test/net
parentfada4d24f9acd98f1e289913f6eea584d281fb42 (diff)
[ruby/net-http] Add ignore_eof access to HTTP and HTTPResponse
The ignore_eof setting on HTTPResponse makes it so an EOFError is raised when reading bodies with a defined Content-Length, if the body read was truncated due to the socket be closed. The ignore_eof setting on HTTP sets the values used in responses that are created by the object. For backwards compatibility, the default is for both settings is true. However, unless you are specifically tested for and handling truncated responses, it's a good idea to set ignore_eof to false so that errors are raised for truncated responses, instead of those errors silently being ignored. Fixes [Bug #14972] https://.com/ruby/net-http/commit/4d47e34995
-rw-r--r--test/net/http/test_http.rb30
1 files changed, 30 insertions, 0 deletions
@@ -1348,3 +1348,33 @@ class TestNetHTTPForceEncoding < Test::Unit::TestCase
assert_equal(Encoding::UTF_8, res.body.encoding)
end
end