Created
August 1, 2015 09:40
-
-
Save quininer/5f77ef4f6d4ca8b3ce82 to your computer and use it in GitHub Desktop.
aiohttp wsgi PATH_INFO parse Error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import asyncio | |
from http.client import responses | |
from aiohttp.wsgi import WSGIServerHttpProtocol | |
@asyncio.coroutine | |
def foo(env, start_res): | |
start_res( | |
"{} {}".format(200, responses.get(200)), | |
{}.items() | |
) | |
return [env.get('PATH_INFO').encode()] | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete( | |
loop.create_server( | |
lambda: WSGIServerHttpProtocol(foo), | |
"127.0.0.1", | |
8000 | |
) | |
) | |
loop.run_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is not reasonable.