summaryrefslogtreecommitdiff
path: root/lib/net/http/generic_request.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 01:08:19 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-14 01:08:19 +0000
commitf58d39807541d8f50ba682183ab9097ddcb52698 ()
treee2f20a5100c5f69f94827d9730b0dff597011493 /lib/net/http/generic_request.rb
parentd266423f8709cb121630cb6e3f403736dbf8ff25 (diff)
* lib/net/http: Do not handle Content-Encoding when the user sets
Accept-Encoding. This allows users to handle Content-Encoding for themselves. This restores backwards-compatibility with Ruby 1.x. * lib/net/http/generic_request.rb: ditto. * lib/net/http/response.rb: ditto * test/net/http/test_http.rb: Test for the above. * test/net/http/test_http_request.rb: ditto. * test/net/http/test_httpresponse.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39232 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/net/http/generic_request.rb19
1 files changed, 19 insertions, 0 deletions
@@ -27,11 +27,14 @@ class Net::HTTPGenericRequest
raise ArgumentError, "HTTP request path is empty" if path.empty?
@path = path
if @response_has_body and Net::HTTP::HAVE_ZLIB then
if !initheader ||
!initheader.keys.any? { |k|
%w[accept-encoding range].include? k.downcase
} then
initheader = initheader ? initheader.dup : {}
initheader["accept-encoding"] =
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
@@ -51,10 +54,25 @@ class Net::HTTPGenericRequest
attr_reader :path
attr_reader :uri
def inspect
"\#<#{self.class} #{@method}>"
end
def request_body_permitted?
@request_has_body
end
@@ -291,6 +309,7 @@ class Net::HTTPGenericRequest
if IO.select([sock.io], nil, nil, sock.continue_timeout)
res = Net::HTTPResponse.read_new(sock)
unless res.kind_of?(Net::HTTPContinue)
throw :response, res
end
end