-
-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanic support: buggy request parsing #42
Comments
According to sanic docs, `request.url` already contains query string, so adding it results in data corruption. This fix worked for me. Fixes miguelgrinberg#42
Thanks for the detailed description. Turns out they have changed the way Thanks again. I'll go ahead and merge your change, but I'll hold off on a release, since the current release works well with the 0.4.x releases of sanic and this change will break those. What a mess. |
According to sanic docs, `request.url` already contains query string, so adding it results in data corruption. This fix worked for me. Fixes #42
When trying to use websocket support with git version of
Sanic
, I had a problem: server kept responding with400 Bad request
when the browser tried to upgrade connection towebsocket
.In the logs I saw the following:
Turned out that
engineio.AsyncServer.handle_request
got two values forsid
, first of which is the wrong and second is correct.Next,
QUERY_STRING
was taken from the output ofself._async['translate_request']
. And Sanic-specific implementation turned out to be buggy.In
engineio.async_sanic.translate_request
function (line 46) it takesrequest.url
and conditionally appendsrequest.query_string
to it. But according to Sanic docs,request.url
holds "The full URL of the request, ie:http://localhost:8000/posts/1/?foo=bar
"This bug resulted in query-string being duplicated and URL being treated like this:
'http://localhost:8000/socket.io/?EIO=3&transport=polling&t=LhzFKOB&sid=c0a70e70d8bc465e9611f5bae89ce083?EIO=3&transport=polling&t=LhzFKOB&sid=c0a70e70d8bc465e9611f5bae89ce083
- notice the duplication.I will now propose the trivial fix as a pull request.
The text was updated successfully, but these errors were encountered: