Skip to content
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

'=' char is now safe in urls; wss:// protocol is now safe #477

Merged
merged 1 commit into from
Aug 30, 2015

Conversation

vshulyak
Copy link
Contributor

The story behind this. I’m building a bot for Slack that communicates through websockets. Before switching to aiohttp websockets I used ‘websockets’ project and it was handling connections just fine.

Switching to aiohttp resulted in an issue with the initial websocket handshake (upgrade). Slack returns an URL which looks like this:

wss://ms309.slack-msgs.com/websocket/ElDcJnfq5Q7DBSEZFd4qxyDPkm3dup6vtkKfrUajWTj5ZcgeN68LdBMwspV9Jz5SDNLW8i_IgjWvgZ7Q4a7lVV2_a_ELfUc77cr4-RdI78s=

aiohttp had two major issues with handling the url above:

  1. wss protocol was treated as non-ssl protocol, resulting effectively in a request to the port 80. Replacing ‘wss’ with ‘https’ fixed it, but that seem to be a hack to me.
  2. the equals symbol at the end of querystring was not treated as ’safe’ which resulted in econding ‘=‘ as ‘%3D’. Slack API returned 400 Bad request.

This patch attempts to fix both of the issues. Not sure if the patch and the tests are fully correct. But my slack bot is now working fine :)

@kxepal
Copy link
Member

kxepal commented Aug 30, 2015

LGFM +1

asvetlov added a commit that referenced this pull request Aug 30, 2015
'=' char is now safe in urls; wss:// protocol is now safe
@asvetlov asvetlov merged commit 6f86f8d into aio-libs:master Aug 30, 2015
@asvetlov
Copy link
Member

Thanks!

@lock
Copy link

lock bot commented Oct 30, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 30, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants