This may be used to generate a Rack response synchronously.
By default we readpartial at most 16K off a socket at once
new (sock, hdr = {}, unchunk = true) source
initializes a socket, sock
must respond to the "readpartial" method. unchunk
may be set to disable transparent unchunking hdr
may be a Hash, Array, or Rack::Utils::HeaderHash
close () source
this is expected to be called by our Rack server, it will close our given sock
object if keepalive is not used otherwise it will just reset the parser and clear the header object
each () { |buf| ... } source
this method allows our Kcar::Response
object to be used as a Rack response body. It may only be called once (usually by a Rack server) as it streams the response body off the our socket object.
rack () source
returns a 3-element array suitable for use as a Rack response:
[ status, headers, body ]
this method will not return until the response headers are fully parsed, but the body returned will be this Kcar::Response
handler itself. It is not guaranteed that trailers will be stored in the returned header
read () source
returns a 3-element array that resembles a Rack response, but is more useful for additional processing by other code.
[ status, headers, body ]
Use Kcar::Response#rack
if you want to guarantee a proper Rack response.
this method will not return until the response headers are fully parsed, but the body returned will be this Kcar::Response
handler itself. unchunk
must be true to guarantee trailers will be stored in the returned header
object
mail archives: https://yhbt.net/kcar-public/ http://ou63pmih66umazou.onion/kcar-public/ nntp://news.public-inbox.org/inbox.comp.lang.ruby.kcar nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.kcar public: kcar-public@yhbt.net source code: git clone https://yhbt.net/kcar.git torsocks git clone http://ou63pmih66umazou.onion/kcar.git