diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-06-30 17:15:56 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-06-30 17:20:13 -0700 |
commit | 20bf660a3efff9229c81b3b3a0feb6844bc27a7c (patch) | |
tree | 004553b916743a54361ba8ca4716d6b63d5cd73e /lib/unicorn/chunked_reader.rb | |
parent | f01c1d4071e8ce30aa6806fd3cd8eec7491bf06c (diff) | |
download | unicorn-20bf660a3efff9229c81b3b3a0feb6844bc27a7c.tar.gz |
Support for the "Trailer:" header and associated Trailer lines should be reasonably well supported now
Diffstat (limited to 'lib/unicorn/chunked_reader.rb')
-rw-r--r-- | lib/unicorn/chunked_reader.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/unicorn/chunked_reader.rb b/lib/unicorn/chunked_reader.rb index f9bd4ec..606e4a6 100644 --- a/lib/unicorn/chunked_reader.rb +++ b/lib/unicorn/chunked_reader.rb @@ -7,8 +7,8 @@ require 'unicorn/http11' module Unicorn class ChunkedReader - def initialize(input, buf) - @input, @buf = input, buf + def initialize(env, input, buf) + @env, @input, @buf = env, input, buf @chunk_left = 0 parse_chunk_header end @@ -71,6 +71,12 @@ module Unicorn @chunk_left = $1.to_i(16) if 0 == @chunk_left # EOF buf.sub!(/\A\r\n(?:\r\n)?/, Z) # cleanup for future requests + if trailer = @env[Const::HTTP_TRAILER] + tp = TrailerParser.new(trailer) + while ! tp.execute!(@env, buf) + buf << @input.readpartial(Const::CHUNK_SIZE) + end + end @input = nil end return @chunk_left |