author | David Douard <david.douard@logilab.fr> |
Fri, 03 Jul 2015 13:43:40 +0200 | |
changeset 10504 | 3755cd64fff8 |
parent 10411 | 4ee15441f2eb |
child 10849 | 79066409fdcf |
permissions | -rw-r--r-- |
8544
3d049071957e
massive copyright update to avoid clutering later patches
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8316
diff
changeset
|
1 |
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4436
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
5867 | 18 |
"""HTTP cache managers""" |
0 | 19 |
|
20 |
__docformat__ = "restructuredtext en" |
|
21 |
||
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
22 |
from time import mktime |
1016
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
762
diff
changeset
|
23 |
from datetime import datetime |
0 | 24 |
|
25 |
class NoHTTPCacheManager(object): |
|
26 |
"""default cache manager: set no-cache cache control policy""" |
|
27 |
def __init__(self, view): |
|
28 |
self.view = view |
|
3460
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
29 |
self.req = view._cw |
3462
3a79fecdd2b4
[magicsearch] make tests pass again: base preprocessor must have access to vreg
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3460
diff
changeset
|
30 |
self.cw_rset = view.cw_rset |
0 | 31 |
|
32 |
def set_headers(self): |
|
33 |
self.req.set_header('Cache-control', 'no-cache') |
|
34 |
||
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
35 |
|
0 | 36 |
class MaxAgeHTTPCacheManager(NoHTTPCacheManager): |
37 |
"""max-age cache manager: set max-age cache control policy, with max-age |
|
38 |
specified with the `cache_max_age` attribute of the view |
|
39 |
""" |
|
40 |
def set_headers(self): |
|
41 |
self.req.set_header('Cache-control', |
|
42 |
'max-age=%s' % self.view.cache_max_age) |
|
43 |
||
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
44 |
|
0 | 45 |
class EtagHTTPCacheManager(NoHTTPCacheManager): |
46 |
"""etag based cache manager for startup views |
|
47 |
||
48 |
* etag is generated using the view name and the user's groups |
|
49 |
* set policy to 'must-revalidate' and expires to the current time to force |
|
50 |
revalidation on each request |
|
51 |
""" |
|
52 |
||
53 |
def etag(self): |
|
5244
5467674ad101
[web] put a fake object that raise Unauthorized on any attribute access as req.cnx and req._user, so we are properly asked to authenticated on any view that tries to do something with one of those attributes (instead of doing defensive programming everywhere we're doing that)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5223
diff
changeset
|
54 |
if not self.req.cnx: # session without established connection to the repo |
5223
6abd6e3599f4
#773448: refactor session and 'no connection' handling, by introducing proper web session. We should now be able to see page even when no anon is configured, and be redirected to the login form as soon as one tries to do a query.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5155
diff
changeset
|
55 |
return self.view.__regid__ |
3460
e4843535db25
[api] some more _cw / __regid__, automatic tests now pass again
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3451
diff
changeset
|
56 |
return self.view.__regid__ + '/' + ','.join(sorted(self.req.user.groups)) |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1149
diff
changeset
|
57 |
|
0 | 58 |
def max_age(self): |
59 |
# 0 to actually force revalidation |
|
60 |
return 0 |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1149
diff
changeset
|
61 |
|
0 | 62 |
def last_modified(self): |
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
63 |
"""return view's last modified GMT time""" |
0 | 64 |
return self.view.last_modified() |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1149
diff
changeset
|
65 |
|
0 | 66 |
def set_headers(self): |
67 |
req = self.req |
|
68 |
try: |
|
69 |
req.set_header('Etag', '"%s"' % self.etag()) |
|
70 |
except NoEtag: |
|
71 |
self.req.set_header('Cache-control', 'no-cache') |
|
72 |
return |
|
73 |
req.set_header('Cache-control', |
|
10348
b9bb4296133d
[http] fix cache-control syntax in EtagHTTPCacheManager
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8544
diff
changeset
|
74 |
'must-revalidate,max-age=%s' % self.max_age()) |
0 | 75 |
mdate = self.last_modified() |
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
76 |
# use a timestamp, not a formatted raw header, and let |
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
77 |
# the front-end correctly generate it |
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
78 |
# ("%a, %d %b %Y %H:%M:%S GMT" return localized date that |
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
79 |
# twisted don't parse correctly) |
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
80 |
req.set_header('Last-modified', mktime(mdate.timetuple()), raw=False) |
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
81 |
|
0 | 82 |
|
83 |
class EntityHTTPCacheManager(EtagHTTPCacheManager): |
|
84 |
"""etag based cache manager for view displaying a single entity |
|
85 |
||
86 |
* etag is generated using entity's eid, the view name and the user's groups |
|
87 |
* get last modified time from the entity definition (this may not be the |
|
88 |
entity's modification time since a view may include some related entities |
|
89 |
with a modification time to consider) using the `last_modified` method |
|
90 |
""" |
|
91 |
def etag(self): |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
92 |
if self.cw_rset is None or len(self.cw_rset) == 0: # entity startup view for instance |
0 | 93 |
return super(EntityHTTPCacheManager, self).etag() |
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
94 |
if len(self.cw_rset) > 1: |
0 | 95 |
raise NoEtag() |
96 |
etag = super(EntityHTTPCacheManager, self).etag() |
|
3451
6b46d73823f5
[api] work in progress, use __regid__, cw_*, etc.
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1977
diff
changeset
|
97 |
eid = self.cw_rset[0][0] |
0 | 98 |
if self.req.user.owns(eid): |
99 |
etag += ',owners' |
|
100 |
return str(eid) + '/' + etag |
|
101 |
||
102 |
||
103 |
class NoEtag(Exception): |
|
104 |
"""an etag can't be generated""" |
|
105 |
||
106 |
__all__ = ('GMTOFFSET', |
|
107 |
'NoHTTPCacheManager', 'MaxAgeHTTPCacheManager', |
|
108 |
'EtagHTTPCacheManager', 'EntityHTTPCacheManager') |
|
109 |
||
110 |
# monkey patching, so view doesn't depends on this module and we have all |
|
111 |
# http cache related logic here |
|
112 |
||
1149 | 113 |
from cubicweb import view as viewmod |
0 | 114 |
|
115 |
def set_http_cache_headers(self): |
|
116 |
self.http_cache_manager(self).set_headers() |
|
1149 | 117 |
viewmod.View.set_http_cache_headers = set_http_cache_headers |
0 | 118 |
|
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
119 |
|
0 | 120 |
def last_modified(self): |
121 |
"""return the date/time where this view should be considered as |
|
122 |
modified. Take care of possible related objects modifications. |
|
123 |
||
124 |
/!\ must return GMT time /!\ |
|
125 |
""" |
|
126 |
# XXX check view module's file modification time in dev mod ? |
|
1016
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
762
diff
changeset
|
127 |
ctime = datetime.utcnow() |
0 | 128 |
if self.cache_max_age: |
3462
3a79fecdd2b4
[magicsearch] make tests pass again: base preprocessor must have access to vreg
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3460
diff
changeset
|
129 |
mtime = self._cw.header_if_modified_since() |
0 | 130 |
if mtime: |
1016
26387b836099
use datetime instead of mx.DateTime
sylvain.thenault@logilab.fr
parents:
762
diff
changeset
|
131 |
tdelta = (ctime - mtime) |
4423
c1850ef961fc
simpler last_modified implementation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4212
diff
changeset
|
132 |
if tdelta.days * 24*60*60 + tdelta.seconds <= self.cache_max_age: |
c1850ef961fc
simpler last_modified implementation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4212
diff
changeset
|
133 |
return mtime |
0 | 134 |
# mtime = ctime will force page rerendering |
4423
c1850ef961fc
simpler last_modified implementation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4212
diff
changeset
|
135 |
return ctime |
1149 | 136 |
viewmod.View.last_modified = last_modified |
0 | 137 |
|
4424
5a5cd7591706
fix spurious http cache bug: sometimes last-modified headers is generated using non-english local, which ends up in a date that twisted can't parse and make it feels the page may be cached while it may not
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4423
diff
changeset
|
138 |
|
0 | 139 |
# configure default caching |
1149 | 140 |
viewmod.View.http_cache_manager = NoHTTPCacheManager |
0 | 141 |
# max-age=0 to actually force revalidation when needed |
1149 | 142 |
viewmod.View.cache_max_age = 0 |
0 | 143 |
|
1149 | 144 |
viewmod.StartupView.http_cache_manager = MaxAgeHTTPCacheManager |
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1149
diff
changeset
|
145 |
viewmod.StartupView.cache_max_age = 60*60*2 # stay in http cache for 2 hours by default |
8316
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
146 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
147 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
148 |
### HTTP Cache validator ############################################ |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
149 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
150 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
151 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
152 |
def get_validators(headers_in): |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
153 |
"""return a list of http condition validator relevant to this request |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
154 |
""" |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
155 |
result = [] |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
156 |
for header, func in VALIDATORS: |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
157 |
value = headers_in.getHeader(header) |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
158 |
if value is not None: |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
159 |
result.append((func, value)) |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
160 |
return result |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
161 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
162 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
163 |
def if_modified_since(ref_date, headers_out): |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
164 |
last_modified = headers_out.getHeader('last-modified') |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
165 |
if last_modified is None: |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
166 |
return True |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
167 |
return ref_date < last_modified |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
168 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
169 |
def if_none_match(tags, headers_out): |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
170 |
etag = headers_out.getHeader('etag') |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
171 |
if etag is None: |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
172 |
return True |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
173 |
return not ((etag in tags) or ('*' in tags)) |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
174 |
|
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
175 |
VALIDATORS = [ |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
176 |
('if-modified-since', if_modified_since), |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
177 |
#('if-unmodified-since', if_unmodified_since), |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
178 |
('if-none-match', if_none_match), |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
179 |
#('if-modified-since', if_modified_since), |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
180 |
] |
d5b1b75805dd
[cache] factorize _validate_cache() logic implemented in wsgi and twisted handlers
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
8176
diff
changeset
|
181 |