From: andy.chu@... Date: 2015-06-18T23:38:44+00:00 Subject: [ruby-core:69670] [Ruby trunk - Bug #11285] [Open] Net::HTTP should handle content-coding with case-insensitive Issue #11285 has been reported by Andy Chu. ---------------------------------------- Bug #11285: Net::HTTP should handle content-coding with case-insensitive https://bugs.ruby-lang.org/issues/11285 * Author: Andy Chu * Status: Open * Priority: Normal * Assignee: * ruby -v: * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- When Ruby Net::HTTP sent a request. It by default set the content to be compress with header: Accept-Encoding But if server return with content-encoding = GZIP (or any case other then all lower case) it will not tread the body as compressed. According to HTTP 1.1 spec, Content-Encoding should be value used by content-coding, and the value of content-coding should be case-insensitive content-coding: http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5 I think simply change the code here: https://github.com/ruby/ruby/blob/trunk/lib/net/http/response.rb#L253 from case self['content-encoding'] to case self['content-encoding'].downcase should work -- https://bugs.ruby-lang.org/