Changeset 5:5b0da5f5192d in livinglogic.python.nightshade

Show
Ignore:
Timestamp:
05/08/06 16:26:24 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Check ETag and Last-Modified before setting modified to True, i.e. if the
response doesn't have ETag or Last-Modified there never will be a 304.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nightshade.py

    r4 r5  
    117117 
    118118        modified = True 
    119         if req_ifmodifiedsince is not None or req_ifnonematch is not None: 
    120             modified = False 
    121             if req_ifmodifiedsince is not None and res_lastmodified is not None and req_ifmodifiedsince != res_lastmodified: 
    122                 modified = True 
    123             if req_ifnonematch is not None and res_etag is not None and req_ifnonematch != res_etag: 
    124                 modified = True 
     119        if req_ifmodifiedsince is not None and req_lastmodified is not None: 
     120            modified = req_ifmodifiedsince != req_lastmodified 
     121        if req_ifnonematch is not None and res_etag is not None and not modified: 
     122            modified = req_ifnonematch != res_etag 
    125123        if not modified: 
    126124            cherrypy.response.status = "304 Not Modified"