106: def call(env)
107: status, headers, body = @app.call(env)
108: if body.respond_to?(:to_path)
109: case type = variation(env)
110: when 'X-Accel-Redirect'
111: path = F.expand_path(body.to_path)
112: if url = map_accel_path(env, path)
113: headers[type] = url
114: body = []
115: else
116: env['rack.errors'] << "X-Accel-Mapping header missing"
117: end
118: when 'X-Sendfile', 'X-Lighttpd-Send-File'
119: path = F.expand_path(body.to_path)
120: headers[type] = path
121: body = []
122: when '', nil
123: else
124: env['rack.errors'] << "Unknown x-sendfile variation: '#{variation}'.\n"
125: end
126: end
127: [status, headers, body]
128: end