Project

General

Profile

Actions

Bug #11285

closed

Net::HTTP should handle content-coding with case-insensitive

Added by littlechu (Andy Chu) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:69670]

Description

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

Actions #1

Updated by naruse (Yui NARUSE) almost 9 years ago

  • Status changed from Open to Closed

Applied in changeset r51061.


  • lib/net/http/response.rb (inflater): CONTENT_ENCODING can be upper
    case. [ruby-core:69670] [Bug #11285] patched by Andy Chu

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) almost 9 years ago

memo: r51063 is required too.

Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

r51061, r51063 and r51091 were backported into ruby_2_2 branch at r51522.

Actions #5

Updated by usa (Usaku NAKAMURA) over 8 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: REQUIRED, 2.1: DONE, 2.2: DONE

ruby_2_1 r51602 merged revision(s) 51061,51063,51091.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0