Skip to content

Use correct port for wss URLs when ssl_context is None #197

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

Merged
merged 1 commit into from
Feb 25, 2025

Conversation

sam-golioth
Copy link
Contributor

Prior to 49b93c1, _url_to_host() modified ssl_context according to whether the URL contained ws or wss. That commit introduced return_ssl_context because the return value has a different type set (ssl.SSLContext | bool) than the passed in argument (ssl.SSLContext | None). But the determination of which port number to use was still based on ssl_context, which would result in port 80 being used in the case where the user passed in a wss:// URL without an SSLContext. Checking return_ssl_context instead results in the correct behavior.

Signed-off-by: Sam Friedman <sam@golioth.io>
sam-golioth added a commit to golioth/python-golioth-tools that referenced this pull request Feb 24, 2025
trio-websocket v0.12 introduced a bug that causes the library to use
port 80 for wss urls instead of port 443. Details are in the PR:
python-trio/trio-websocket#197

Pin the trio-websocket dependency to v0.11.1 until the fix is
merged and released.

Signed-off-by: Sam Friedman <sam@golioth.io>
sam-golioth added a commit to golioth/python-golioth-tools that referenced this pull request Feb 24, 2025
trio-websocket v0.12 introduced a bug that causes the library to use
port 80 for wss urls instead of port 443. Details are in the PR:
python-trio/trio-websocket#197

Pin the trio-websocket dependency to v0.11.1 until the fix is
merged and released.

Signed-off-by: Sam Friedman <sam@golioth.io>
sam-golioth added a commit to golioth/python-golioth-tools that referenced this pull request Feb 24, 2025
trio-websocket v0.12 introduced a bug that causes the library to use
port 80 for wss urls instead of port 443. Details are in the PR:
python-trio/trio-websocket#197

Pin the trio-websocket dependency to v0.11.1 until the fix is
merged and released.

Signed-off-by: Sam Friedman <sam@golioth.io>
Copy link
Contributor

@A5rocks A5rocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Not sure why we didn't just enable redefinitions given that would have avoided this (I think).

I'm a bit curious why test cases didn't fail.

@A5rocks A5rocks requested a review from belm0 February 24, 2025 23:38
Copy link
Member

@belm0 belm0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙄

@belm0 belm0 merged commit 65400cb into python-trio:master Feb 25, 2025
10 checks passed
@trio-bot
Copy link

trio-bot bot commented Feb 25, 2025

Hey @sam-golioth, it looks like that was the first time we merged one of your PRs! Thanks so much! 🎉 🎂

If you want to keep contributing, we'd love to have you. So, I just sent you an invitation to join the python-trio organization on Github! If you accept, then here's what will happen:

  • Github will automatically subscribe you to notifications on all our repositories. (But you can unsubscribe again if you don't want the spam.)

  • You'll be able to help us manage issues (add labels, close them, etc.)

  • You'll be able to review and merge other people's pull requests

  • You'll get a [member] badge next to your name when participating in the Trio repos, and you'll have the option of adding your name to our member's page and putting our icon on your Github profile (details)

If you want to read more, here's the relevant section in our contributing guide.

Alternatively, you're free to decline or ignore the invitation. You'll still be able to contribute as much or as little as you like, and I won't hassle you about joining again. But if you ever change your mind, just let us know and we'll send another invitation. We'd love to have you, but more importantly we want you to do whatever's best for you.

If you have any questions, well... I am just a humble Python script, so I probably can't help. But please do post a comment here, or in our chat, or on our forum, whatever's easiest, and someone will help you out!

@belm0
Copy link
Member

belm0 commented Feb 25, 2025

Prior to 49b93c1

a.k.a. the PR merged without my approval - #193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants