lib/rack/contrib/sendfile.rb in rack-contrib-1.3.0 vs lib/rack/contrib/sendfile.rb in rack-contrib-1.4.0
- old
+ new
@@ -92,30 +92,28 @@
# RequestHeader Set X-Sendfile-Type X-Sendfile
# ProxyPassReverse / http://localhost:8001/
# XSendFile on
class Sendfile
- F = ::File
-
def initialize(app, variation=nil)
@app = app
@variation = variation
end
def call(env)
status, headers, body = @app.call(env)
if body.respond_to?(:to_path)
case type = variation(env)
when 'X-Accel-Redirect'
- path = F.expand_path(body.to_path)
+ path = ::File.expand_path(body.to_path)
if url = map_accel_path(env, path)
headers[type] = url
body = []
else
env['rack.errors'] << "X-Accel-Mapping header missing"
end
when 'X-Sendfile', 'X-Lighttpd-Send-File'
- path = F.expand_path(body.to_path)
+ path = ::File.expand_path(body.to_path)
headers[type] = path
body = []
when '', nil
else
env['rack.errors'] << "Unknown x-sendfile variation: '#{variation}'.\n"