Mercurial > p > roundup > code
changeset 8021:98429efb80cb
fix: Send vary header for if-modified-since conditional returning 304
Send the vary: accept-encoding header if a conditional
if-modified-since requests results in a 304 not modified response.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 02 Jun 2024 22:15:10 -0400 |
| parents | 60c98a8a23bd |
| children | f023b66c297d |
| files | CHANGES.txt roundup/cgi/client.py |
| diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Sun Jun 02 20:35:47 2024 -0400 +++ b/CHANGES.txt Sun Jun 02 22:15:10 2024 -0400 @@ -166,6 +166,8 @@ testing. (John Rouillard) - make If-None-Match work for static file (@@file) case. Found by Redbot testing (John Rouillard) +- Send vary: accept-encoding for if-modified-since conditional + requests where the file is not modified. (John Rouillard) Features:
--- a/roundup/cgi/client.py Sun Jun 02 20:35:47 2024 -0400 +++ b/roundup/cgi/client.py Sun Jun 02 22:15:10 2024 -0400 @@ -1999,10 +1999,15 @@ ims = email.utils.parsedate(ims)[:6] lmtt = time.gmtime(lmt)[:6] if lmtt <= ims: - if (self.determine_content_encoding()): - # set vary header as though we were returning 200 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Vary - self.setVary("Accept-Encoding") + # because we can compress, always set Accept-Encoding + # value. Otherwise caches can serve up the wrong info + # if their cached copy has no compression. + self.setVary("Accept-Encoding") + ''' + to solve issue2551356 I may need to determine + the content encoding. + if (self.determine_content_encoding()): + ''' raise NotModified # don't set until we are sure we are sending a response body.
