Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/net/http/header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def content_length=(len)
def chunked?
return false unless @header['transfer-encoding']
field = self['Transfer-Encoding']
(/(?:\A|[^\-\w])chunked(?![\-\w])\s*(?:,\s*)*\z/i =~ field) ? true : false
(/(?:\A|[,)])\s*chunked\s*(?:,\s*)*\z/i =~ field) ? true : false
end

# Returns a Range object representing the value of field
Expand Down
6 changes: 6 additions & 0 deletions test/net/http/test_httpheader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ def test_chunked_final_transfer_coding
try_chunked false, 'gzip'
end

def test_chunked_not_a_list_member
try_chunked false, 'identity chunked'
try_chunked false, 'gzip;param=chunked'
try_chunked false, 'x/chunked'
end

def try_chunked(bool, str)
@c['transfer-encoding'] = str
assert_equal bool, @c.chunked?
Expand Down
Loading