Sha256: aba0b16bf1b57a9f1ce29cbac8aeff147bbc54d3d61bfa079b386a3e4fe7dab3

Contents?: true

Size: 513 Bytes

Versions: 31

Compression:

Stored size: 513 Bytes

Contents

module Rack
  # TODO: For some reason in Rack (or maybe thin), 304 headers close
  # the http connection.  We might need to make this check if keep
  # alive was in the request.
  class KeepAlive
    def initialize(app)
      @app = app
    end

    def call(env)
      status, headers, body = @app.call(env)

      if status == 304 && env['HTTP_CONNECTION'] && env['HTTP_CONNECTION'].downcase == 'keep-alive'
        headers['Connection'] = 'keep-alive'
      end

      [status, headers, body]
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
volt-0.9.5.pre2 lib/volt/server/rack/keep_alive.rb
volt-0.9.5.pre1 lib/volt/server/rack/keep_alive.rb
volt-0.9.4 lib/volt/server/rack/keep_alive.rb
volt-0.9.4.pre5 lib/volt/server/rack/keep_alive.rb
volt-0.9.4.pre3 lib/volt/server/rack/keep_alive.rb
volt-0.9.4.pre2 lib/volt/server/rack/keep_alive.rb
volt-0.9.4.pre1 lib/volt/server/rack/keep_alive.rb
volt-0.9.3 lib/volt/server/rack/keep_alive.rb
volt-0.9.3.pre6 lib/volt/server/rack/keep_alive.rb
volt-0.9.3.pre5 lib/volt/server/rack/keep_alive.rb
volt-0.9.3.pre4 lib/volt/server/rack/keep_alive.rb