summaryrefslogtreecommitdiff
path: root/lib/net/http/response.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net/http/response.rb')
-rw-r--r--lib/net/http/response.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
index bde3b5b440..da3e4b4c8c 100644
--- a/lib/net/http/response.rb
+++ b/lib/net/http/response.rb
@@ -80,6 +80,7 @@ class Net::HTTPResponse
@body = nil
@read = false
@uri = nil
+ @decode_content = false
end
# The HTTP version supported by the server.
@@ -98,6 +99,10 @@ class Net::HTTPResponse
# if a URI was used to create the request.
attr_reader :uri
+ # Set to true automatically when the request did not contain an
+ # Accept-Encoding header from the user.
+ attr_accessor :decode_content
+
def inspect
"#<#{self.class} #{@code} #{@message} readbody=#{@read}>"
end
@@ -242,6 +247,7 @@ class Net::HTTPResponse
def inflater # :nodoc:
return yield @socket unless Net::HTTP::HAVE_ZLIB
+ return yield @socket unless @decode_content
return yield @socket if self['content-range']
case self['content-encoding']