Mercurial > libervia-web
comparison src/server/server.py @ 1019:34240d08f682
pages: HTTP cache headers handling:
when checkCache is used, HTTP headers handling cache are now used:
- ETag is first checked, using a hash of the rendered content
- Last-Modified is used as a fallback is client is not handling ETag
When suitable, a HTTP 304 code (Not Modified) wihtout body is returned instead of the whole page.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 21 Jan 2018 13:14:06 +0100 |
parents | 6b573b4b5bb0 |
children | dc6c8c4d8ff6 |
comparison
equal
deleted
inserted
replaced
1018:78af5457d3f8 | 1019:34240d08f682 |
---|---|
1907 return self.getExtBaseURL(request, path=scheme, scheme=scheme) | 1907 return self.getExtBaseURL(request, path=scheme, scheme=scheme) |
1908 | 1908 |
1909 def registerWSToken(self, token, page, request): | 1909 def registerWSToken(self, token, page, request): |
1910 websockets.LiberviaPageWSProtocol.registerToken(token, page, request) | 1910 websockets.LiberviaPageWSProtocol.registerToken(token, page, request) |
1911 | 1911 |
1912 ## Various utils ## | |
1913 | |
1914 def getHTTPDate(self, timestamp=None): | |
1915 now = time.gmtime(timestamp) | |
1916 fmt_date = u"{day_name}, %d {month_name} %Y %H:%M:%S GMT".format( | |
1917 day_name = C.HTTP_DAYS[now.tm_wday], | |
1918 month_name = C.HTTP_MONTH[now.tm_mon-1]) | |
1919 return time.strftime(fmt_date, now) | |
1920 | |
1912 ## TLS related methods ## | 1921 ## TLS related methods ## |
1913 | 1922 |
1914 def _TLSOptionsCheck(self): | 1923 def _TLSOptionsCheck(self): |
1915 """Check options coherence if TLS is activated, and update missing values | 1924 """Check options coherence if TLS is activated, and update missing values |
1916 | 1925 |