Issue #6494 has been updated by naruse (Yui NARUSE).


This change breaks code which calls initialize with initheader=nil.
-  def initialize(m, reqbody, resbody, path, initheader = nil)
+  def initialize(m, reqbody, resbody, path, initheader = {})


Following 
+    if @response_has_body and Net::HTTP::HAVE_ZLIB then
+      unless initheader.keys.any? { |k| k.downcase == "accept-encoding" }
+        initheader = initheader.merge({
+          "accept-encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
+        })
+      end
+    end

should be

+      if !initheader || !initheader.keys.any? { |k| k.downcase == "accept-encoding" }
+        initheader = initheader ? initheader.dup : {}
+        initheader["accept-encoding"] = "gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
+      end
----------------------------------------
Feature #6494: Send Accept-Encoding for all HTTP requests
https://bugs.ruby-lang.org/issues/6494#change-26878

Author: drbrain (Eric Hodel)
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: 2.0.0


This patch builds atop #6492 to enable Accept-Encoding by default for all HTTP requests that permit bodies.  (Without #6492 it will break Net::HTTP.)

This patch moves setting the Accept-Encoding header from Net::HTTP#get to Net::HTTP::GenericRequest#initialize.


-- 
http://bugs.ruby-lang.org/