aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-05 04:58:57 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-01-05 04:58:57 +0000
commit0d375e732d83c96451a671f7eb9522c773cd3038 (patch)
tree310b9e6880e9b174af4c97b801193b01857ce1ba
parent76731871e70398afbd044e16e9cf4151b471841b (diff)
downloadruby-0d375e732d83c96451a671f7eb9522c773cd3038.tar.gz
* lib/net/http.rb (Net::HTTP#get): A header hash given should not
be modified. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/net/http.rb4
-rw-r--r--test/net/http/test_http.rb4
3 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 418012c931..fbbe4477cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Jan 5 13:56:54 2011 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/net/http.rb (Net::HTTP#get): A header hash given should not
+ be modified.
+
Wed Jan 5 13:56:03 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* SSL_shutdown should be called until the return value is non-zero:
diff --git a/lib/net/http.rb b/lib/net/http.rb
index cc0a0b20dc..fac9a0beb1 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -987,7 +987,9 @@ module Net #:nodoc:
res = nil
if HAVE_ZLIB
unless initheader.keys.any?{|k| k.downcase == "accept-encoding"}
- initheader["accept-encoding"] = "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
+ initheader = initheader.merge({
+ "accept-encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
+ })
@compression = true
end
end
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 5e5cdab9ff..9833a8e9e5 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -42,6 +42,10 @@ module TestNetHTTP_version_1_1_methods
assert_equal $test_net_http_data_type, res['Content-Type']
assert_equal $test_net_http_data.size, res.body.size
assert_equal $test_net_http_data, res.body
+
+ assert_nothing_raised {
+ res, body = http.get('/', { 'User-Agent' => 'test' }.freeze)
+ }
end
def _test_get__iter(http)