webmcp
diff framework/env/request/handler.lua @ 291:fa3a5bba0067
Cache control; Added documentation for request.add_header(...)
author | jbe |
---|---|
date | Sun Mar 22 17:03:01 2015 +0100 (2015-03-22) |
parents | 81711c529eb2 |
children | c1b561ee56c1 |
line diff
1.1 --- a/framework/env/request/handler.lua Sun Mar 22 13:20:55 2015 +0100 1.2 +++ b/framework/env/request/handler.lua Sun Mar 22 17:03:01 2015 +0100 1.3 @@ -248,6 +248,14 @@ 1.4 for i, header in ipairs(request._response_headers) do 1.5 http_request:send_header(header[1], header[2]) 1.6 end 1.7 + if not request._cache_manual then 1.8 + local cache_time = request._cache_time 1.9 + if request._cache and cache_time and cache_time > 0 then 1.10 + http_request:send_header("Cache-Control", "max-age=" .. cache_time) 1.11 + else 1.12 + http_request:send_header("Cache-Control", "no-cache") 1.13 + end 1.14 + end 1.15 http_request:send_header("Content-Type", slot.get_content_type()) 1.16 http_request:send_data(slot.render_layout()) 1.17 http_request:finish()