Rack response body instance for chunked responses using Transfer-Encoding: chunked.
Public Class methods
new(scope)
Save the scope of the current request handling.
[show source]
# File lib/roda/plugins/chunked.rb 173 def initialize(scope) 174 @scope = scope 175 end
Public Instance methods
each()
For each response chunk yielded by the scope, yield it it to the caller in chunked format, starting with the size of the request in ASCII hex format, then the chunk. After all chunks have been yielded, yield a 0 sized chunk to finish the response.
[show source]
# File lib/roda/plugins/chunked.rb 182 def each 183 @scope.each_chunk do |chunk| 184 next if !chunk || chunk.empty? 185 yield("%x\r\n" % chunk.bytesize) 186 yield(chunk) 187 yield("\r\n") 188 end 189 ensure 190 yield("0\r\n\r\n") 191 end