When processing uploads, Unicorn may expose a StreamInput object under “rack.input” of the (future) Rack (2.x) environment.
Initializes a new StreamInput object. You normally do not have to call this unless you are writing an HTTP server.
Executes the block for every “line” in ios, where lines are separated by the global record separator ($/, typically “n”).
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.
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!