mirror of https://gitlab.com/bashrc2/epicyon
Don't send 304s for avatars or media
parent
5211451693
commit
bf433e34f0
27
daemon.py
27
daemon.py
|
@ -6486,10 +6486,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
mediaStr = path.split('/media/')[1]
|
||||
mediaFilename = baseDir + '/media/' + mediaStr
|
||||
if os.path.isfile(mediaFilename):
|
||||
if self._etag_exists(mediaFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
# TEST
|
||||
#if self._etag_exists(mediaFilename):
|
||||
# # The file has not changed
|
||||
# self._304()
|
||||
# return
|
||||
|
||||
mediaFileType = mediaFileMimeType(mediaFilename)
|
||||
|
||||
|
@ -6685,10 +6686,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""
|
||||
mediaFilename = baseDir + '/cache' + path
|
||||
if os.path.isfile(mediaFilename):
|
||||
if self._etag_exists(mediaFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return
|
||||
# TEST
|
||||
# if self._etag_exists(mediaFilename):
|
||||
# # The file has not changed
|
||||
# self._304()
|
||||
# return
|
||||
with open(mediaFilename, 'rb') as avFile:
|
||||
mediaBinary = avFile.read()
|
||||
mimeType = mediaFileMimeType(mediaFilename)
|
||||
|
@ -11367,10 +11369,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
acctDir(baseDir, avatarNickname, domain) + '/' + avatarFile
|
||||
if not os.path.isfile(avatarFilename):
|
||||
return False
|
||||
if self._etag_exists(avatarFilename):
|
||||
# The file has not changed
|
||||
self._304()
|
||||
return True
|
||||
# TEST
|
||||
# if self._etag_exists(avatarFilename):
|
||||
# # The file has not changed
|
||||
# self._304()
|
||||
# return True
|
||||
|
||||
t = os.path.getmtime(avatarFilename)
|
||||
lastModifiedTime = datetime.datetime.fromtimestamp(t)
|
||||
|
|
Loading…
Reference in New Issue