Class: Rack::KeepAlive

Inherits:
Object show all
Defined in:
lib/volt/server.rb

Overview

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.

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ KeepAlive

Returns a new instance of KeepAlive.



37
38
39
# File 'lib/volt/server.rb', line 37

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/volt/server.rb', line 41

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

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

  [status, headers, body]
end