main
Bob Mottram 2020-05-29 13:48:33 +01:00
parent 1a70ece630
commit 41feec3c1e
1 changed files with 5 additions and 0 deletions

View File

@ -1824,7 +1824,9 @@ class PubServer(BaseHTTPRequestHandler):
# default favicon
faviconFilename = \
self.server.baseDir + '/img/icons/favicon.ico'
print('favicon: ' + faviconFilename)
if self._etag_exists(faviconFilename):
print('favicon etag exists')
# The file has not changed
self._304()
return
@ -1835,9 +1837,11 @@ class PubServer(BaseHTTPRequestHandler):
favBinary, cookie,
callingDomain)
self._write(favBinary)
print('favicon sent from cache')
return
else:
if os.path.isfile(faviconFilename):
print('favicon image file exists')
with open(faviconFilename, 'rb') as favFile:
favBinary = favFile.read()
self._set_headers_etag(faviconFilename,
@ -1846,6 +1850,7 @@ class PubServer(BaseHTTPRequestHandler):
callingDomain)
self._write(favBinary)
self.server.iconsCache['favicon.ico'] = favBinary
print('favicon sent')
return
self._404()
return