lib/protocol/http1/body/chunked.rb in protocol-http1-0.13.2 vs lib/protocol/http1/body/chunked.rb in protocol-http1-0.14.0

- old
+ new

@@ -24,11 +24,10 @@ module Protocol module HTTP1 module Body class Chunked < HTTP::Body::Readable - TRAILERS = 'trailers' CRLF = "\r\n" def initialize(stream, headers) @stream = stream @finished = false @@ -60,11 +59,11 @@ length = read_line.to_i(16) if length == 0 @finished = true - read_trailers + read_trailer return nil end # Read trailing CRLF: @@ -87,12 +86,12 @@ def read_line @stream.gets(CRLF, chomp: true) end - def read_trailers + def read_trailer while line = read_line - # Empty line indicates end of headers: + # Empty line indicates end of trailer: break if line.empty? if match = line.match(HEADER) @headers.add(match[1], match[2]) else