Class: Gearup::Server::GzRewrite

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ GzRewrite

Returns a new instance of GzRewrite.



27
28
29
# File 'lib/gearup/server.rb', line 27

def initialize app
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/gearup/server.rb', line 31

def call env
  if env["PATH_INFO"] =~ /\.gz$/
    env["PATH_INFO"] = env["PATH_INFO"].sub(/\.gz$/, "")
    env["REQUEST_PATH"] = env["REQUEST_PATH"].sub(/\.gz$/, "")
    env["REQUEST_URI"] = env["REQUEST_URI"].sub(/\.gz$/, "")
  end
  @app.call(env)
end