1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

Add similar extra logging for localhost handler

* This also adjusts the logging in Session.auth_callback() because it
  can be called from either protocol.  Saying 'edmc://' there is
  misleading.
This commit is contained in:
Athanasius 2021-03-15 12:13:28 +00:00
parent 4f524a0a35
commit cc2395ca04
2 changed files with 5 additions and 2 deletions

@ -437,8 +437,8 @@ class Session(object):
# Callback from protocol handler
def auth_callback(self) -> None:
"""Handle callback from edmc:// handler."""
logger.debug('Handling callback from edmc:// handler')
"""Handle callback from edmc:// or localhost:/auth handler."""
logger.debug('Handling auth callback')
if self.state != Session.STATE_AUTH:
# Shouldn't be getting a callback
logger.debug('Got an auth callback while not doing auth')

@ -36,6 +36,7 @@ class GenericProtocolHandler(object):
def event(self, url):
self.lastpayload = url
logger.trace(f'Payload: {self.lastpayload}')
if not config.shutting_down:
logger.debug('event_generate("<<CompanionAuthEvent>>"')
self.master.event_generate('<<CompanionAuthEvent>>', when="tail")
@ -247,8 +248,10 @@ else: # Linux / Run from source
class HTTPRequestHandler(BaseHTTPRequestHandler):
def parse(self):
logger.trace(f'Got message on path: {self.path}')
url = urllib.parse.unquote(self.path)
if url.startswith('/auth'):
logger.debug('Request starts with /auth, sending to protocolhandler.event()')
protocolhandler.event(url)
self.send_response(200)
return True