Extra debug

main
Bob Mottram 2020-08-15 11:11:02 +01:00
parent fc78164ba4
commit 2f7b2be363
1 changed files with 34 additions and 4 deletions

View File

@ -1334,6 +1334,8 @@ class PubServer(BaseHTTPRequestHandler):
len(msg), len(msg),
None, callingDomain) None, callingDomain)
self._write(msg) self._write(msg)
if self.server.debug:
print('Sent manifest: ' + callingDomain)
return return
# favicon image # favicon image
@ -1353,6 +1355,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.baseDir + '/img/icons/' + favFilename self.server.baseDir + '/img/icons/' + favFilename
if self._etag_exists(faviconFilename): if self._etag_exists(faviconFilename):
# The file has not changed # The file has not changed
if self.server.debug:
print('favicon icon has not changed: ' + callingDomain)
self._304() self._304()
return return
if self.server.iconsCache.get(favFilename): if self.server.iconsCache.get(favFilename):
@ -1362,6 +1366,8 @@ class PubServer(BaseHTTPRequestHandler):
favBinary, cookie, favBinary, cookie,
callingDomain) callingDomain)
self._write(favBinary) self._write(favBinary)
if self.server.debug:
print('Sent favicon from cache: ' + callingDomain)
return return
else: else:
if os.path.isfile(faviconFilename): if os.path.isfile(faviconFilename):
@ -1373,7 +1379,11 @@ class PubServer(BaseHTTPRequestHandler):
callingDomain) callingDomain)
self._write(favBinary) self._write(favBinary)
self.server.iconsCache[favFilename] = favBinary self.server.iconsCache[favFilename] = favBinary
if self.server.debug:
print('Sent favicon from file: ' + callingDomain)
return return
if self.server.debug:
print('favicon not sent: ' + callingDomain)
self._404() self._404()
return return
@ -1446,6 +1456,9 @@ class PubServer(BaseHTTPRequestHandler):
fontBinary, cookie, fontBinary, cookie,
callingDomain) callingDomain)
self._write(fontBinary) self._write(fontBinary)
if self.server.debug:
print('font sent from cache: ' +
self.path + ' ' + callingDomain)
return return
else: else:
if os.path.isfile(fontFilename): if os.path.isfile(fontFilename):
@ -1457,7 +1470,12 @@ class PubServer(BaseHTTPRequestHandler):
callingDomain) callingDomain)
self._write(fontBinary) self._write(fontBinary)
self.server.fontsCache[fontStr] = fontBinary self.server.fontsCache[fontStr] = fontBinary
if self.server.debug:
print('font sent from file: ' +
self.path + ' ' + callingDomain)
return return
if self.server.debug:
print('font not found: ' + self.path + ' ' + callingDomain)
self._404() self._404()
return return
@ -1512,9 +1530,15 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/xml', len(msg), self._set_headers('text/xml', len(msg),
cookie, callingDomain) cookie, callingDomain)
self._write(msg) self._write(msg)
if self.server.debug:
print('Sent rss2 feed: ' +
self.path + ' ' + callingDomain)
return return
self._404() if self.server.debug:
return print('Failed to get rss2 feed: ' +
self.path + ' ' + callingDomain)
self._404()
return
# RSS 3.0 # RSS 3.0
if self.path.startswith('/blog/') and \ if self.path.startswith('/blog/') and \
@ -1550,9 +1574,15 @@ class PubServer(BaseHTTPRequestHandler):
self._set_headers('text/plain; charset=utf-8', self._set_headers('text/plain; charset=utf-8',
len(msg), cookie, callingDomain) len(msg), cookie, callingDomain)
self._write(msg) self._write(msg)
if self.server.debug:
print('Sent rss3 feed: ' +
self.path + ' ' + callingDomain)
return return
self._404() if self.server.debug:
return print('Failed to get rss3 feed: ' +
self.path + ' ' + callingDomain)
self._404()
return
# show the main blog page # show the main blog page
if htmlGET and (self.path == '/blog' or if htmlGET and (self.path == '/blog' or