summaryrefslogtreecommitdiff
path: root/lib/net/http.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/http.rb')
-rw-r--r--lib/net/http.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 5e64e38665..dc8ed051f0 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -699,6 +699,7 @@ module Net #:nodoc:
@max_retries = 1
@debug_output = nil
@response_body_encoding = false
+ @ignore_eof = true
@proxy_from_env = false
@proxy_uri = nil
@@ -839,6 +840,10 @@ module Net #:nodoc:
# The default value is 2 seconds.
attr_accessor :keep_alive_timeout
+ # Whether to ignore EOF when reading response bodies with defined
+ # Content-Length headers. For backwards compatibility, the default is true.
+ attr_accessor :ignore_eof
+
# Returns true if the HTTP session has been started.
def started?
@started
@@ -1606,6 +1611,7 @@ module Net #:nodoc:
res = HTTPResponse.read_new(@socket)
res.decode_content = req.decode_content
res.body_encoding = @response_body_encoding
+ res.ignore_eof = @ignore_eof
end while res.kind_of?(HTTPInformation)
res.uri = req.uri