Skip to content

Commit

Permalink
fix event loop bug with aiohttp 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wang0618 committed Nov 5, 2021
1 parent 3869738 commit 3c84305
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pywebio/platform/aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .utils import make_applications, render_page, cdn_validation, deserialize_binary_event
from ..session import CoroutineBasedSession, ThreadBasedSession, register_session_implement_for_target, Session
from ..session.base import get_session_info_from_headers
from ..utils import get_free_port, STATIC_PATH, iscoroutinefunction, isgeneratorfunction
from ..utils import get_free_port, STATIC_PATH, iscoroutinefunction, isgeneratorfunction, func_params

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -45,9 +45,9 @@ def _webio_handler(applications, cdn, websocket_settings, check_origin_func=_is_
:param callable check_origin_func: check_origin_func(origin, host) -> bool
:return: aiohttp Request Handler
"""
ioloop = asyncio.get_event_loop()

async def wshandle(request: web.Request):
ioloop = asyncio.get_event_loop()

origin = request.headers.get('origin')
if origin and not check_origin_func(origin=origin, host=request.host):
return web.Response(status=403, text="Cross origin websockets not allowed")
Expand Down

0 comments on commit 3c84305

Please sign in to comment.