webmcp
diff framework/env/request/process.lua @ 250:db79324a13fe
Work on static file delivery
author | jbe |
---|---|
date | Sun Mar 01 21:38:07 2015 +0100 (2015-03-01) |
parents | 4748410d27ac |
children | 23901a8f0d58 |
line diff
1.1 --- a/framework/env/request/process.lua Sun Mar 01 21:20:29 2015 +0100 1.2 +++ b/framework/env/request/process.lua Sun Mar 01 21:38:07 2015 +0100 1.3 @@ -15,6 +15,14 @@ 1.4 local success, error_info = xpcall( 1.5 function() 1.6 1.7 + if request._route.static then 1.8 + local f = assert(file.open(request._route.static, "r")) 1.9 + local d = f:read("*a") 1.10 + f:close() 1.11 + slot.put_into("data", d) 1.12 + slot.set_layout(nil, "application/octet-stream") -- TODO 1.13 + end 1.14 + 1.15 -- restore slots if coming from http redirect 1.16 local tempstore_value = request._http_request.get_params["_tempstore"] 1.17 if tempstore_value then