diff --git a/ahserver/auth_api.py b/ahserver/auth_api.py index a305412..926c78d 100755 --- a/ahserver/auth_api.py +++ b/ahserver/auth_api.py @@ -15,6 +15,9 @@ class AuthAPI(AppLogger): super().__init__() self.conf = getConfig() + async def checkUserPermission(self, user, path): + return True + def getPrivateKey(self): if not hasattr(self,'rsaEngine'): self.rsaEngine = RSA() @@ -64,10 +67,6 @@ class AuthAPI(AppLogger): print(f'**{user=}, {path} forbidden**') raise web.HTTPForbidden() - async def checkUserPermission(self, user, path): - raise Exception('checkUserPermission()') - return False - async def needAuth(self,path): return False diff --git a/ahserver/baseProcessor.py b/ahserver/baseProcessor.py index 0098f9c..73b78a8 100755 --- a/ahserver/baseProcessor.py +++ b/ahserver/baseProcessor.py @@ -58,6 +58,9 @@ class BaseProcessor(AppLogger): } self.content = '' + async def be_call(self, request, params={}): + return await self.path_call(request, params=params) + async def set_run_env(self, request): if self.env_set: return diff --git a/ahserver/processorResource.py b/ahserver/processorResource.py index dd738b9..af87062 100755 --- a/ahserver/processorResource.py +++ b/ahserver/processorResource.py @@ -116,7 +116,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): if request.query: return multiDict2Dict(request.query) ns = multiDict2Dict(md) - print(f'{ns=} reader is None, {request.query=}') + # print(f'{ns=} reader is None, {request.query=}') return ns ns = {} while 1: @@ -147,7 +147,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): print('-----------except out ------------') break; # showcallstack() - print(f'getPostData():{ns=}') + # print(f'getPostData():{ns=}') return ns async def _handle(self,request:Request) -> StreamResponse: @@ -329,8 +329,8 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): def url2processor(self, request, url, fpath): config = getConfig() url = self.entireUrl(request, url) - host = '/'.join(str(request.url).split('/')[:3]) - path = request.path + host = '/'.join(url.split('/')[:3]) + path = '/' + '/'.join(url.split('/')[3:]) real_path = self.abspath(request, path) if config.website.startswiths: for a in config.website.startswiths: @@ -365,5 +365,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File): url = self.entireUrl(request, path) fpath = self.url2file(url) processor = self.url2processor(request, url, fpath) - return await processor.path_call(request, params=params) + new_request = request.clone(rel_url=url) + # new_request.path = path + return await processor.be_call(new_request, params=params) diff --git a/change.log b/change.log old mode 100644 new mode 100755