Bug 7560 - Incorrect "Last-Modified" sent by tlwebaccess and tlwebadm
Summary: Incorrect "Last-Modified" sent by tlwebaccess and tlwebadm
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Other (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.13.0
Assignee: Pierre Ossman
URL:
Keywords: nikle_tester, prosaic
Depends on:
Blocks:
 
Reported: 2020-09-30 11:32 CEST by Pierre Ossman
Modified: 2020-10-06 14:06 CEST (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Pierre Ossman cendio 2020-09-30 11:32:51 CEST
We are not sending the correct Last-Modified header when serving files from tlwebaccess and tlwebadm. The standard says it should be sent in the rfc822 format:

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
https://tools.ietf.org/html/rfc7231#section-7.1.1.1

However we are sending the output of ctime(), which uses a different format and is using local time, not UTC.

Note that HTTP (but not MDN) specifies that the format that ctime() uses should be tolerated, but it must be UTC. So we are currently pushing the boundaries of what is allowed.

Practical effects are currently unknown. Worst case scenario should be that caching doesn't work correctly and browsers fetch resources needlessly.
Comment 1 Pierre Ossman cendio 2020-10-01 13:35:36 CEST
Firefox oddly enough sends the same string back to us in the If-Modified-Since header, so it is unclear if it doesn't parse the string or if it somehow remembers we are using a deprecated format.

This should break though as we assume that If-Modified-Since follows rfc822. Fortunately Python's rfc822.parsedate() tolerates some other formats, so it works anyway.

It is untested if both deprecated formats specified by HTTP are supported though.
Comment 2 Pierre Ossman cendio 2020-10-01 13:40:48 CEST
Chrome's behaviour is unclear at this point. It is caching things at least, but I'm unable to prod it into sending any If-Modified-Since headers.
Comment 3 Pierre Ossman cendio 2020-10-01 14:44:41 CEST
(In reply to Pierre Ossman from comment #2)
> Chrome's behaviour is unclear at this point. It is caching things at least,
> but I'm unable to prod it into sending any If-Modified-Since headers.

Waiting a while makes Chrome do a request with the header, and it seems to follow the same behaviour as Firefox (using the same format it got from the server).
Comment 6 Pierre Ossman cendio 2020-10-01 14:46:20 CEST
Fixed now. Can see the correct date format in the sent headers. Tested using Firefox and Chrome.
Comment 7 Niko Lehto cendio 2020-10-06 14:06:02 CEST
Date format looks good in both Firefox 80 and Chrome 85.
Looked at both webaccess and webadmin pages.

Note You need to log in before you can comment on or make changes to this bug.