Use etags on images

main
Bob Mottram 2020-04-13 20:28:35 +01:00
parent 6009193a66
commit 1c66f2fde7
1 changed files with 14 additions and 9 deletions

View File

@ -1440,8 +1440,10 @@ class PubServer(BaseHTTPRequestHandler):
time.sleep(1)
tries += 1
if mediaBinary:
self._set_headers('image/png', len(mediaBinary),
cookie, callingDomain)
self._set_headers_etag(mediaFilename,
'image/png',
mediaBinary, cookie,
callingDomain)
self._write(mediaBinary)
return
self._404()
@ -1466,8 +1468,9 @@ class PubServer(BaseHTTPRequestHandler):
time.sleep(1)
tries += 1
if mediaBinary:
self._set_headers('image/png', len(mediaBinary),
cookie, callingDomain)
self._set_headers_etag(mediaFilename, 'image/png',
mediaBinary, cookie,
callingDomain)
self._write(mediaBinary)
return
self._404()
@ -1492,8 +1495,9 @@ class PubServer(BaseHTTPRequestHandler):
time.sleep(1)
tries += 1
if mediaBinary:
self._set_headers('image/png', len(mediaBinary),
cookie, callingDomain)
self._set_headers_etag(mediaFilename, 'image/png',
mediaBinary, cookie,
callingDomain)
self._write(mediaBinary)
return
self._404()
@ -1521,9 +1525,10 @@ class PubServer(BaseHTTPRequestHandler):
mediaImageType = 'gif'
with open(emojiFilename, 'rb') as avFile:
mediaBinary = avFile.read()
self._set_headers('image/' + mediaImageType,
len(mediaBinary),
cookie, callingDomain)
self._set_headers_etag(emojiFilename,
'image/' + mediaImageType,
mediaBinary, cookie,
callingDomain)
self._write(mediaBinary)
return
self._404()