Modify ↓
#9070 closed enhancement (worksforme)
trac.web.api.Request.send_file: test for modification date and If-Modified-Since header
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | general | Version: | 0.12dev |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
here it reads
stat = os.stat(path)
mtime = datetime.fromtimestamp(stat.st_mtime, localtz)
last_modified = http_date(mtime)
if last_modified == self.get_header('If-Modified-Since'):
self.send_response(304)
self.send_header('Content-Length', 0)
self.end_headers()
raise RequestDone
should this not be
if last_modified <= self.get_header('If-Modified-Since'):
?
Attachments (0)
Note:
See TracTickets
for help on using tickets.



It will not make a difference. If the
If-Modified-Sinceheader is present, that means the client has already requested the file before. Then you have one of the following cases:last_modifiedwill always be greater than the value of the header.Or in other words: if the header doesn't match the last modification time, the client doesn't have the correct file content, so we want to send it anyway.