OLD | NEW |
(Empty) | |
| 1 # A support server that returns a resource to be cached for one year. |
| 2 # |
| 3 # However, if the request contains the "Cache-Control: only-if-cached;" header, |
| 4 # the server returns status code 500, since such a request should never have |
| 5 # reached it. |
| 6 def main(request, response): |
| 7 if ("Cache-Control" in request._headers and |
| 8 request._headers["Cache-Control"] == "only-if-cached"): |
| 9 response.status = 500 # Internal server error. |
| 10 return |
| 11 |
| 12 return ([("Content-Type", "text/plain"), |
| 13 ("Cache-Control", "max-age=31536000")], |
| 14 "Resource to be cached for 365 days.") |
OLD | NEW |