Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
session: Work around sanic bug
Browse files Browse the repository at this point in the history
Upstream issue at sanic-org/sanic#2457
  • Loading branch information
PromyLOPh committed May 18, 2022
1 parent bf394bf commit 6f4b89a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bawwab/session.py
Expand Up @@ -99,7 +99,8 @@ async def csrfOriginCheck (request):
origin = request.headers.get ('origin')
if origin:
originUrl = furl (origin).set (path='/')
requestUrl = furl (request.url).set (path='/', query=None, fragment=None)
# XXX: Work around https://github.com/sanic-org/sanic/issues/2457
requestUrl = furl (request.url.replace (':://', '://')).set (path='/', query=None, fragment=None)
# Fix the scheme for websocket requests
if requestUrl.scheme in {'ws', 'wss'}:
requestUrl = requestUrl.set (scheme=originUrl.scheme)
Expand Down

0 comments on commit 6f4b89a

Please sign in to comment.