mirror of https://gitlab.com/bashrc2/epicyon
Use etags on images
parent
6009193a66
commit
1c66f2fde7
23
daemon.py
23
daemon.py
|
@ -1440,8 +1440,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tries += 1
|
tries += 1
|
||||||
if mediaBinary:
|
if mediaBinary:
|
||||||
self._set_headers('image/png', len(mediaBinary),
|
self._set_headers_etag(mediaFilename,
|
||||||
cookie, callingDomain)
|
'image/png',
|
||||||
|
mediaBinary, cookie,
|
||||||
|
callingDomain)
|
||||||
self._write(mediaBinary)
|
self._write(mediaBinary)
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
|
@ -1466,8 +1468,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tries += 1
|
tries += 1
|
||||||
if mediaBinary:
|
if mediaBinary:
|
||||||
self._set_headers('image/png', len(mediaBinary),
|
self._set_headers_etag(mediaFilename, 'image/png',
|
||||||
cookie, callingDomain)
|
mediaBinary, cookie,
|
||||||
|
callingDomain)
|
||||||
self._write(mediaBinary)
|
self._write(mediaBinary)
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
|
@ -1492,8 +1495,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
tries += 1
|
tries += 1
|
||||||
if mediaBinary:
|
if mediaBinary:
|
||||||
self._set_headers('image/png', len(mediaBinary),
|
self._set_headers_etag(mediaFilename, 'image/png',
|
||||||
cookie, callingDomain)
|
mediaBinary, cookie,
|
||||||
|
callingDomain)
|
||||||
self._write(mediaBinary)
|
self._write(mediaBinary)
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
|
@ -1521,9 +1525,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
mediaImageType = 'gif'
|
mediaImageType = 'gif'
|
||||||
with open(emojiFilename, 'rb') as avFile:
|
with open(emojiFilename, 'rb') as avFile:
|
||||||
mediaBinary = avFile.read()
|
mediaBinary = avFile.read()
|
||||||
self._set_headers('image/' + mediaImageType,
|
self._set_headers_etag(emojiFilename,
|
||||||
len(mediaBinary),
|
'image/' + mediaImageType,
|
||||||
cookie, callingDomain)
|
mediaBinary, cookie,
|
||||||
|
callingDomain)
|
||||||
self._write(mediaBinary)
|
self._write(mediaBinary)
|
||||||
return
|
return
|
||||||
self._404()
|
self._404()
|
||||||
|
|
Loading…
Reference in New Issue