class Rack::KeepAlive

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.

Public Class Methods

new(app) click to toggle source
# File lib/volt/server/rack/keep_alive.rb, line 6
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/volt/server/rack/keep_alive.rb, line 10
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