Roundup Tracker - Issues

Issue 2551356

classification
Add etag header when If-Modified-Since GET request returns not-modified (304)
Type: behavior Severity: normal
Components: Web interface Versions:
process
Status: fixed fixed
:
: rouilj : rouilj
Priority: :

Created on 2024-06-03 02:10 by rouilj, last changed 2024-12-10 21:06 by rouilj.

Messages
msg8087 Author: [hidden] (rouilj) Date: 2024-06-03 02:10
You can do conditional requests in HTTP using an ETag with the If-None-Match header or a date 
with the If-Modified-Since header. This is supported for static files (/@@file/).

if-modified-since (ims) has been supported for a while, but redbot.org reports that it
is not supplying the ETag header when returning a 304 not modified response.
I tried to fix this, but it's turning into a hairball so I am deferring the
fix/reorg until after 2.4.0 is released.

One issue I have is that the etag is different for different Content-Encodings. In
the REST flow, I just append the content-encoding (gzip, zstd, br) to the base etag
(inode-length-modifiedtime).

When I implemented support for If-None-Match, I was able to return the right
encoding sensitive etag because the encoding sensitive etag is sent by the browser.

With IMS, I don't have any hint about the encoding originally used to deliver the file.
I might have to make a best guess by treating it as a non-conditional get. Doing all
the work to figure out what headers and encoding I would send.
msg8225 Author: [hidden] (rouilj) Date: 2024-12-10 21:06
This is fixed if a static file is being served. or when the content served by
serve_file() is an actual file on disk.

If the content served by serve_file() is not an actual file (e.g. content in a database
or an S3 bucket), only the Last-Modified header is emitted.

This change also supports reporting 304 with the if-none-match header if it has just
a single etag value without spaces around it. This could be made more forgiving
and support a list of etags by using the etag functions from the rest.py module.

However currently the etag is not content-encoding aware. So it doesn't have the -gzip
suffix used by the rest interface.

But the initial issue is solved and redbot is happy.
History
Date User Action Args
2024-12-10 21:06:38rouiljsetstatus: new -> fixed
assignee: rouilj
resolution: fixed
messages: + msg8225
2024-06-03 02:10:43rouiljcreate