From 9ca20f92f2d3dedb4b9e98e94c623fe2b06e2aed Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 19 Feb 2020 15:12:05 +0000 Subject: [PATCH] Respond to connection requests --- daemon.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/daemon.py b/daemon.py index cfc7e835..f93aa24a 100644 --- a/daemon.py +++ b/daemon.py @@ -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') @@ -927,8 +930,13 @@ class PubServer(BaseHTTPRequestHandler): if self._requestHTTP(): htmlGET=True else: - print('WARN: No Accept header '+str(self.headers)) - self._400() + 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() return self._benchmarkGETtimings(GETstartTime,GETtimings,7)