Merge lp://staging/~rharding/convoy/add_listmod_header into lp://staging/convoy

Proposed by Richard Harding
Status: Needs review
Proposed branch: lp://staging/~rharding/convoy/add_listmod_header
Merge into: lp://staging/convoy
Diff against target: 304 lines (+140/-32)
2 files modified
convoy/combo.py (+34/-9)
convoy/tests/test_combo.py (+106/-23)
To merge this branch: bzr merge lp://staging/~rharding/convoy/add_listmod_header

Commit message

Add a last-modified header to the response so browsers/web servers can help prevent sending unchanged files.

Description of the change

= Summary =
Convoy should return a last-modified header to help allow browsers in sending 304 responses to the same combo files already stored.

== Proposed Fix ==
Track the mtime of the files as we process them and return that as a Last-Modified header in the response.

== Implementation Details ==
This was a bit intrusive. Since the response is really just the looping through the files I had to pull out the list of files in order to find the latest mtime. This means we add an additional loop of the files to the overall process.

The tests then had to be updated since the combine_files now expexts full paths vs the partials. Each of the tests either had to update the file paths themself, or I just used the new build_filelist to do it.

== Tests ==
- Updated the tests to call build_filelist
- Added the Last-Modified to the header checks
- Added a check to verify the Last-Header is correct.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Personally I wouldn't send a last-mod, if you send a hash of the
content of the files - a strong validator - browsers will send an
if-none-match conditional, and you *won't* have to deal with the
fallout of fs datestamp skew (which would cause headache for LP, for
instance).

-Rob

Unmerged revisions

22. By Richard Harding

Garden

21. By Richard Harding

Update convoy to supply a last-modified header

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: