diff roundup/cgi/client.py @ 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 e1cff9745fb4
line wrap: on
line diff
--- 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.

Roundup Issue Tracker: http://roundup-tracker.org/