(self)
| 612 | self.end_headers() |
| 613 | |
| 614 | def do_GET(self): |
| 615 | # check here request header to identify the type of req, if http or ws |
| 616 | # if this is a ws req, instance a ws handler, add it to App's ws list, return |
| 617 | if "Upgrade" in self.headers: |
| 618 | if self.headers['Upgrade'].lower() == 'websocket': |
| 619 | #passing arguments to websocket handler, otherwise it will lost the last message, |
| 620 | # and will be unable to handshake |
| 621 | ws = WebSocketsHandler(self.headers, self.request, self.client_address, self.server) |
| 622 | return |
| 623 | |
| 624 | """Handler for the GET requests.""" |
| 625 | do_process = False |
| 626 | if self.server.auth is None: |
| 627 | do_process = True |
| 628 | else: |
| 629 | if not ('Authorization' in self.headers) or self.headers['Authorization'] is None: |
| 630 | self._log.info("Authenticating") |
| 631 | self.do_AUTHHEAD() |
| 632 | self.wfile.write(encode_text('no auth header received')) |
| 633 | elif self.headers['Authorization'] == 'Basic ' + self.server.auth.decode(): |
| 634 | do_process = True |
| 635 | else: |
| 636 | self.do_AUTHHEAD() |
| 637 | self.wfile.write(encode_text(self.headers['Authorization'])) |
| 638 | self.wfile.write(encode_text('not authenticated')) |
| 639 | |
| 640 | if do_process: |
| 641 | path = str(unquote(self.path)) |
| 642 | # noinspection PyBroadException |
| 643 | try: |
| 644 | self._instance() |
| 645 | # build the page (call main()) in user code, if not built yet |
| 646 | with self.update_lock: |
| 647 | # build the root page once if necessary |
| 648 | if not 'root' in self.page.children['body'].children.keys(): |
| 649 | self._log.info('built UI (path=%s)' % path) |
| 650 | self.set_root_widget(self.main(*self.server.userdata)) |
| 651 | self._process_all(path) |
| 652 | except Exception: |
| 653 | self._log.error('error processing GET request', exc_info=True) |
| 654 | |
| 655 | def all_paths(self): |
| 656 | paths = {'res': os.path.join(os.path.dirname(__file__), "res")} |
nothing calls this directly
no test coverage detected