diff options
Diffstat (limited to 'lib/kcar/response.rb')
-rw-r--r-- | lib/kcar/response.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/kcar/response.rb b/lib/kcar/response.rb index dba7fc8..954502c 100644 --- a/lib/kcar/response.rb +++ b/lib/kcar/response.rb @@ -7,8 +7,6 @@ class Kcar::Response attr_accessor :sock, :hdr, :unchunk, :buf, :parser # :stopdoc: - LAST_CHUNK = "0\r\n" - CRLF = "\r\n" Parser = Kcar::Parser # :startdoc: @@ -91,12 +89,12 @@ class Kcar::Response size = dst.size if size > 0 yield("#{size.to_s(16)}\r\n") - yield(dst << CRLF) + yield(dst << "\r\n".freeze) end break if @parser.body_eof? end while @buf << @sock.readpartial(READ_SIZE, dst) - yield LAST_CHUNK + yield "0\r\n".freeze until @parser.trailers(@hdr, @buf) @buf << @sock.readpartial(READ_SIZE, dst) @@ -106,7 +104,7 @@ class Kcar::Response # in the response, we'll just yield a stringified version to our # server and pretend it's part of the body. trailers = @parser.extract_trailers(@hdr) - yield(trailers.map! { |k,v| "#{k}: #{v}\r\n" }.join << CRLF) + yield(trailers.map! { |k,v| "#{k}: #{v}\r\n" }.join << "\r\n".freeze) end def each_until_eof |