Parent

Unicorn::StreamInput

When processing uploads, Unicorn may expose a StreamInput object under “rack.input” of the (future) Rack (2.x) environment.

Public Class Methods

new(socket, request) view method source

Initializes a new StreamInput object. You normally do not have to call this unless you are writing an HTTP server.

Public Instance Methods

each { |line| block } => ios view method source

Executes the block for every “line” in ios, where lines are separated by the global record separator ($/, typically “n”).

gets => string or nil view method source

Reads the next “line” from the I/O stream; lines are separated by the global record separator ($/, typically “n”). A global record separator of nil reads the entire unread contents of ios. Returns nil if called at the end of file. This takes zero arguments for strict Rack::Lint compatibility, unlike IO#gets.

read([length [, buffer ]]) => string, buffer, or nil view method source

Reads at most length bytes from the I/O stream, or to the end of file if length is omitted or is nil. length must be a non-negative integer or nil. If the optional buffer argument is present, it must reference a String, which will receive the data.

At end of file, it returns nil or ” depend on length. ios.read() and ios.read(nil) returns ”. ios.read(length [, buffer]) returns nil.

If the Content-Length of the HTTP request is known (as is the common case for POST requests), then ios.read(length [, buffer]) will block until the specified length is read (or it is the last chunk). Otherwise, for uncommon “Transfer-Encoding: chunked” requests, ios.read(length [, buffer]) will return immediately if there is any data and only block when nothing is available (providing IO#readpartial semantics).

Originally generated with the Darkfish Rdoc Generator 2, modified by wrongdoc.

We love to hear from you!
Email patches (with git send-email), pull requests, questions, bug reports, suggestions, etc. to us publically at mongrel-unicorn@rubyforge.org.
No subscription to the mailing list is necessary, just let us know to Cc: you if you're unsubscribed.
To subscribe, email mongrel-unicorn-request@rubyforge.org with "subscribe" in the Subject and respond to the automated confirmation message.
Do not waste bandwidth with HTML, HTML mail will not be read.
Quote only parts you're responding to and do not top post.
For sensitive topics, email us privately at unicorn@bogomips.org.