Use ETag for user-side caching
Pretty hard-code ETag use. ETag is just a timestamp, and the server checks whether it's recent enough.master
parent
e2c3375eb6
commit
d3c163fb74
9
morss.py
9
morss.py
|
@ -412,7 +412,16 @@ if __name__ == '__main__':
|
|||
log(url)
|
||||
|
||||
if 'REQUEST_URI' in os.environ:
|
||||
if 'HTTP_IF_NONE_MATCH' in os.environ:
|
||||
log('etag sent')
|
||||
if time.time() - int(os.environ['HTTP_IF_NONE_MATCH'][1:-1]) < DELAY:
|
||||
log('etag good')
|
||||
print 'Status: 304'
|
||||
print
|
||||
sys.exit(0)
|
||||
|
||||
print 'Status: 200'
|
||||
print 'ETag: "%s"' % int(time.time())
|
||||
|
||||
if options == 'progress':
|
||||
print 'Content-Type: application/octet-stream'
|
||||
|
|
Loading…
Reference in New Issue