def call(env)
request = Rack::Request.new(env)
case request.path_info
when '', '/', app.url_path_prefix
dragonfly_response
else
job = Job.from_path(request.path_info, app)
job.validate_sha!(request['s']) if app.protect_from_dos_attacks
Response.new(job, env).to_response
end
rescue Serializer::BadString, Job::InvalidArray => e
log.warn(e.message)
[404, {'Content-Type' => 'text/plain'}, ['Not found']]
rescue Job::NoSHAGiven => e
[400, {"Content-Type" => 'text/plain'}, ["You need to give a SHA parameter"]]
rescue Job::IncorrectSHA => e
[400, {"Content-Type" => 'text/plain'}, ["The SHA parameter you gave (#{e}) is incorrect"]]
end