Fuyukai / Kyoukai

[OLD] A fully async web framework for Python3.5+ using asyncio
https://mirai.veriny.tf
MIT License
298 stars 14 forks source link

Bad URL requests hang forever #2

Closed andrewzah closed 8 years ago

andrewzah commented 8 years ago

For example, localhost:4444/xapi/v2/u/Dad-12262/stats/general or localhost:4444/api/v0/u/Dad-12262/heroes.

Console Log:

2016-08-05 13:01:07,923 - [INFO] OWAPI -> Started OWAPI server.
2016-08-05 13:01:17,291 - [INFO] Kyokai -> HTTP/1.1 GET /xapi/v2/u/Dad-12262/stats/general - 404
2016-08-05 13:01:17,298 - [ERROR] asyncio -> Task exception was never retrieved
future: <Task finished coro=<Kyoukai.delegate_request() done, defined at /usr/local/lib/python3.5/site-packages/kyoukai/app.py:316> exception=AttributeError("'NoneType' object has no attribute 'groups'",)>
Traceback (most recent call last):
  File "uvloop/task.pyx", line 126, in uvloop.loop.BaseTask._fast_step (uvloop/loop.c:97501)
  File "/usr/local/lib/python3.5/site-packages/kyoukai/app.py", line 352, in delegate_request
    await self.handle_http_error(fof, protocol, ctx)
  File "/usr/local/lib/python3.5/site-packages/kyoukai/app.py", line 303, in handle_http_error
    resp = wrap_response(await error_handler.invoke(ctx))
  File "/usr/local/lib/python3.5/site-packages/kyoukai/route.py", line 108, in invoke
    matches = self.matcher.fullmatch(ctx.request.path).groups()
AttributeError: 'NoneType' object has no attribute 'groups'

Possible solutions: Redirect malformed requests somewhere, or return a general error.

Fuyukai commented 8 years ago

I am 90% sure this will fix it - Can you install Kyoukai from the repo (pip install -U git+https://github.com/SunDwarf/Kyoukai.git) and check it?

andrewzah commented 8 years ago

Yep- http://localhost:4444/dapi/v2/u/Dad-12262/heroes/general now returns:

{'error': 404}
Fuyukai commented 8 years ago

Alright, I will push this to PyPI then.