1.4 KiB
1.4 KiB
| name | description | version | tags | ||||
|---|---|---|---|---|---|---|---|
| ahserver-post-debugging | Fix ahserver POST 405, upload hang, or empty params_kw. | 1.0.0 |
|
ahserver POST Debugging
1. POST 405 — _allowed_methods not updated
ProcessorResource.__init__ updates _routes but not _allowed_methods. aiohttp checks the latter.
Fix: After self._routes.update(...), add:
self._allowed_methods = set(self._routes.keys())
2. Upload hangs — client_max_size too small
Default client_max_size: 10000 (bytes). Files >10KB hang silently.
Fix: Set in conf/config.json:
"website": { "client_max_size": 104857600 }
3. params_kw empty for multipart — auth crashes
getPostData() → get_session_user() → auth.get_auth() raises RuntimeError without middleware. Exception breaks the multipart loop, params_kw stays empty.
Fix: In auth_api.py:
async def get_session_userinfo(request):
try:
d = await auth.get_auth(request)
except:
d = None
...
4. Handler request.read() empty — body consumed
getPostData() already reads the body before handler runs. Use params_kw + FileStorage.realPath() instead.
Diagnostic order
- 405? → fix
_allowed_methods - Small works, large hangs? → fix
client_max_size params_kwempty? → fix auth- Body empty? → use
params_kw