Respond to connection requests

main
Bob Mottram 2020-02-19 15:12:05 +00:00
parent 0a97317314
commit 9ca20f92f2
1 changed files with 10 additions and 2 deletions

View File

@ -470,6 +470,9 @@ class PubServer(BaseHTTPRequestHandler):
print('Error when showing '+str(httpCode))
print(e)
def _200(self) -> None:
self._httpReturnCode(200,'Ok')
def _404(self) -> None:
self._httpReturnCode(404,'Not Found')
@ -926,6 +929,11 @@ class PubServer(BaseHTTPRequestHandler):
if self.headers.get('Accept'):
if self._requestHTTP():
htmlGET=True
else:
if self.headers.get('Connection'):
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism
print('HTTP Connection request: '+self.headers['Connection'])
self._200()
else:
print('WARN: No Accept header '+str(self.headers))
self._400()