Class: Rack::KeepAlive
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
- #call(env) ⇒ Object
-
#initialize(app) ⇒ KeepAlive
constructor
A new instance of KeepAlive.
Constructor Details
#initialize(app) ⇒ KeepAlive
Returns a new instance of KeepAlive.
31 32 33 |
# File 'lib/volt/server.rb', line 31 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/volt/server.rb', line 35 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 |