Hal De преди 4 години
родител
ревизия
703cf6fdcb
променени са 1 файла, в които са добавени 2 реда и са изтрити 8 реда
  1. 2 8
      app/app.py

+ 2 - 8
app/app.py

@@ -117,14 +117,7 @@ class AuthMiddleware:
       for device in app.cache['devices']:
         if ((header == bytes('{}_{}'.format(app.config['AUTH_HEADER'].lower(), device), 'utf-8')) and
             (value == bytes(app.cache['devices'][device], 'utf-8'))):
-          body = bytes('scope: {}'.format(pformat(scope, indent=1)), 'utf-8')
-          await send({'type': 'http.response.start',
-                      'status': 200,
-                      'headers': [(b'content-length', bytes(str(len(body)), 'utf-8'))]})
-          await send({'type': 'http.response.body',
-                      'body': body,
-                      'more_body': False})
-
+          scope['headers'][b'device']=bytes(device, 'utf-8')
           return await self.app(scope, receive, send)
     # Paths "/openapi.json" and "/ui" do not require auth
     if (('path' in scope) and
@@ -304,6 +297,7 @@ async def amiGetVar(variable):
 
 @app.route('/ami/auths')
 async def amiPJSIPShowAuths():
+  app.logger.warning(pformat(request.headers))
   return successReply(app.cache['devices'])
 
 @app.route('/ami/aors')