class HTTP_Spew::ContentMD5
this uses a pipe internally so it can use IO.tee in the “io_splice” RubyGem
Attributes
bytes_digested[R]
content_md5[R]
to_io[R]
Public Class Methods
new(env, input = env["rack.input"])
click to toggle source
# File lib/http_spew/content_md5.rb, line 9 def initialize(env, input = env["rack.input"]) if trailer = env["HTTP_TRAILER"] unless trailer.split(/\s*,\s*/).grep(/\AContent-MD5\z/i)[0] trailer << (trailer.empty? ? "Content-MD5".freeze : ",Content-MD5".freeze) end else env["HTTP_TRAILER"] = "Content-MD5".freeze end env["HTTP_TRANSFER_ENCODING"] = "chunked".freeze @to_io, wr = HTTP_Spew::ChunkyPipe.new expect_md5 = env.delete("HTTP_CONTENT_MD5") expect_len = env.delete("CONTENT_LENGTH") start_write_driver(input, wr, expect_md5, expect_len) end
Public Instance Methods
read(length, buffer = "")
click to toggle source
compatible with IO#read and Rack::InputWrapper#read
# File lib/http_spew/content_md5.rb, line 26 def read(length, buffer = "") # calls HTTP_Spew::ChunkyPipe#read @to_io.read(length, buffer) end