Class | Camping::Server::XSendfile |
In: |
lib/camping/server.rb
|
Parent: | Object |
# File lib/camping/server.rb, line 174 174: def call(env) 175: status, headers, body = @app.call(env) 176: 177: if key = headers.keys.grep(/X-Sendfile/i).first 178: filename = headers[key] 179: content = open(filename,'rb') { | io | io.read} 180: headers['Content-Length'] = size(content).to_s 181: body = [content] 182: end 183: 184: return status, headers, body 185: end