Parent

Namespace

Methods

Included Modules

Class Index [+]

Quicksearch

Rack::Chunked

Middleware that applies chunked transfer encoding to response bodies when the response does not include a Content-Length header.

Public Class Methods

new(app) click to toggle source
    # File lib/rack/chunked.rb, line 38
38:     def initialize(app)
39:       @app = app
40:     end

Public Instance Methods

call(env) click to toggle source
    # File lib/rack/chunked.rb, line 42
42:     def call(env)
43:       status, headers, body = @app.call(env)
44:       headers = HeaderHash.new(headers)
45: 
46:       if env['HTTP_VERSION'] == 'HTTP/1.0' ||
47:          STATUS_WITH_NO_ENTITY_BODY.include?(status) ||
48:          headers['Content-Length'] ||
49:          headers['Transfer-Encoding']
50:         [status, headers, body]
51:       else
52:         headers.delete('Content-Length')
53:         headers['Transfer-Encoding'] = 'chunked'
54:         [status, headers, Body.new(body)]
55:       end
56:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.