# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1394729073 -3600
# Thu Mar 13 17:44:33 2014 +0100
# Node ID 8a03e8d1e24f6b9df0b5aaa3f3fefb659986d693
# Parent e8b9a3d23ad93e47391fe566012812245f2a751b
[web] Fix HEAD request handling
Don't special-case HEAD in CubicWebRequestBase.is_client_cache_valid so
we don't return garbage. HEAD is supposed to return the actual headers
that a GET would return, which we can't do if we bypass all the normal
cubicweb logic. In particular, we no longer always return 200, and
return the right Content-Length/Content-Type/...
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1394729073 -3600
# Thu Mar 13 17:44:33 2014 +0100
# Node ID 8a03e8d1e24f6b9df0b5aaa3f3fefb659986d693
# Parent e8b9a3d23ad93e47391fe566012812245f2a751b
[web] Fix HEAD request handling
Don't special-case HEAD in CubicWebRequestBase.is_client_cache_valid so
we don't return garbage. HEAD is supposed to return the actual headers
that a GET would return, which we can't do if we bypass all the normal
cubicweb logic. In particular, we no longer always return 200, and
return the right Content-Length/Content-Type/...
@@ -777,14 +777,10 @@
1 # Forge expected response 2 if modified: 3 if 'Expires' not in self.headers_out: 4 # Expires header seems to be required by IE7 -- Are you sure ? 5 self.add_header('Expires', 'Sat, 01 Jan 2000 00:00:00 GMT') 6 - if self.http_method() == 'HEAD': 7 - self.status_out = 200 8 - # XXX replace by True once validate_cache bw compat method is dropped 9 - return 200 10 # /!\ no raise, the function returns and we keep processing the request 11 else: 12 # overwrite headers_out to forge a brand new not-modified response 13 self.headers_out = self._forge_cached_headers() 14 if self.http_method() in ('HEAD', 'GET'):