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('Error when showing '+str(httpCode))
print(e) print(e)
def _200(self) -> None:
self._httpReturnCode(200,'Ok')
def _404(self) -> None: def _404(self) -> None:
self._httpReturnCode(404,'Not Found') self._httpReturnCode(404,'Not Found')
@ -926,6 +929,11 @@ class PubServer(BaseHTTPRequestHandler):
if self.headers.get('Accept'): if self.headers.get('Accept'):
if self._requestHTTP(): if self._requestHTTP():
htmlGET=True 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: else:
print('WARN: No Accept header '+str(self.headers)) print('WARN: No Accept header '+str(self.headers))
self._400() self._400()