Return of the etags

main
Bob Mottram 2020-05-25 17:32:13 +01:00
parent 354ba728f5
commit 24c77eca7b
1 changed files with 21 additions and 21 deletions

View File

@ -1119,29 +1119,29 @@ class PubServer(BaseHTTPRequestHandler):
fontType = 'application/font-woff2'
fontFilename = \
self.server.baseDir + '/fonts/' + fontStr
#if self._etag_exists(fontFilename):
if self._etag_exists(fontFilename):
# The file has not changed
# self._304()
# return
#if self.server.fontsCache.get(fontStr):
# fontBinary = self.server.fontsCache[fontStr]
# self._set_headers_etag(fontFilename,
# fontType,
# fontBinary, cookie,
# callingDomain)
# self._write(fontBinary)
# return
#else:
if os.path.isfile(fontFilename):
with open(fontFilename, 'rb') as avFile:
fontBinary = avFile.read()
self._set_headers_etag(fontFilename,
fontType,
fontBinary, cookie,
callingDomain)
self._write(fontBinary)
self.server.fontsCache[fontStr] = fontBinary
self._304()
return
if self.server.fontsCache.get(fontStr):
fontBinary = self.server.fontsCache[fontStr]
self._set_headers_etag(fontFilename,
fontType,
fontBinary, cookie,
callingDomain)
self._write(fontBinary)
return
else:
if os.path.isfile(fontFilename):
with open(fontFilename, 'rb') as avFile:
fontBinary = avFile.read()
self._set_headers_etag(fontFilename,
fontType,
fontBinary, cookie,
callingDomain)
self._write(fontBinary)
self.server.fontsCache[fontStr] = fontBinary
return
self._404()
return