728 # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.3 |
728 # see http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.3 |
729 validators = get_validators(self._headers_in) |
729 validators = get_validators(self._headers_in) |
730 if validators: # if we have no |
730 if validators: # if we have no |
731 modified = any(func(val, self.headers_out) for func, val in validators) |
731 modified = any(func(val, self.headers_out) for func, val in validators) |
732 # Forge expected response |
732 # Forge expected response |
733 if modified: |
733 if not modified: |
734 if 'Expires' not in self.headers_out: |
|
735 # Expires header seems to be required by IE7 -- Are you sure ? |
|
736 self.add_header('Expires', 'Sat, 01 Jan 2000 00:00:00 GMT') |
|
737 # /!\ no raise, the function returns and we keep processing the request |
|
738 else: |
|
739 # overwrite headers_out to forge a brand new not-modified response |
734 # overwrite headers_out to forge a brand new not-modified response |
740 self.headers_out = self._forge_cached_headers() |
735 self.headers_out = self._forge_cached_headers() |
741 if self.http_method() in ('HEAD', 'GET'): |
736 if self.http_method() in ('HEAD', 'GET'): |
742 self.status_out = http_client.NOT_MODIFIED |
737 self.status_out = http_client.NOT_MODIFIED |
743 else: |
738 else: |