diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/http.rb | 4 | ||||
-rw-r--r-- | test/net/http/test_http.rb | 4 |
3 files changed, 12 insertions, 1 deletions
@@ -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) |