Index: lib/xmlrpc/client.rb =================================================================== --- lib/xmlrpc/client.rb (revision 41241) +++ lib/xmlrpc/client.rb (working copy) @@ -479,6 +479,8 @@ module XMLRPC # :nodoc: @http_last_response = resp + content_encoding = resp['Content-Encoding'] + data = resp.body if resp.code == "401" @@ -499,7 +501,13 @@ module XMLRPC # :nodoc: end end - expected = resp["Content-Length"] || "" + expected = + if %w[deflate gzip x-gzip].include? content_encoding then + "" + else + resp["Content-Length"] || "" + end + if data.nil? or data.bytesize == 0 raise "Wrong size. Was #{data.bytesize}, should be #{expected}" elsif expected != "" and expected.to_i != data.bytesize and resp["Transfer-Encoding"].nil?