| Class | Camping::Server::XSendfile |
| In: |
lib/camping/server.rb
|
| Parent: | Object |
| HEADERS | = | [ "X-Sendfile", "X-Accel-Redirect", "X-LIGHTTPD-send-file" |
# File lib/camping/server.rb, line 168
168: def call(env)
169: status, headers, body = @app.call(env)
170: headers = Rack::Utils::HeaderHash.new(headers)
171: if header = HEADERS.detect { |header| headers.include?(header) }
172: path = headers[header]
173: body = File.read(path)
174: headers['Content-Length'] = body.length.to_s
175: end
176: [status, headers, body]
177: end