# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1395653698 -3600
# Mon Mar 24 10:34:58 2014 +0100
# Node ID 9f09c9c18cbb2127bbf167fee1e0b0ffdd8035f3
# Parent e8b9a3d23ad93e47391fe566012812245f2a751b
[web] Fix HEAD request handling (closes #3677949)
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 1395653698 -3600
# Mon Mar 24 10:34:58 2014 +0100
# Node ID 9f09c9c18cbb2127bbf167fee1e0b0ffdd8035f3
# Parent e8b9a3d23ad93e47391fe566012812245f2a751b
[web] Fix HEAD request handling (closes #3677949)
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'):