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

Support sni_hostname extension with SOCKS proxy. #774

Merged
merged 8 commits into from
Sep 1, 2023

Conversation

Allgot
Copy link
Contributor

@Allgot Allgot commented Aug 8, 2023

Summary

The introduction of a new extension, sni_hostname, allows users to define the hostname to be used during the TLS handshake. However, the update was applied inconsistently, leading to an incomplete extension. Currently, the sni_hostname extension is not functioning when a SOCKS proxy is employed. This PR aims to address this gap and rectify the issue.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Closes #772

@Allgot Allgot marked this pull request as ready for review August 8, 2023 18:04
@karpetrosyan
Copy link
Member

Great, Thanks. Let's also update the changelog.

Copy link
Member

@karpetrosyan karpetrosyan left a comment

Choose a reason for hiding this comment

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

Unit tests should only test one specific thing and should ideally have only one assertion. I believe this test is overly complicated, so let us simplify it.

extensions={"sni_hostname": "example.com"},
) as response:
info = [repr(c) for c in proxy.connections]
assert info == [
Copy link
Member

Choose a reason for hiding this comment

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

Let's remove this check

assert response.status == 200
assert response.content == b"Hello, world!"
info = [repr(c) for c in proxy.connections]
assert info == [
Copy link
Member

Choose a reason for hiding this comment

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

And this

@karpetrosyan
Copy link
Member

Also, I'm not sure if this test actually checks whether sni_hostname works or not, so let's just remove it entirely.

@tomchristie tomchristie merged commit 56c0e4f into encode:master Sep 1, 2023
4 checks passed
@tomchristie
Copy link
Member

Thanks @Allgot.

@tomchristie tomchristie mentioned this pull request Sep 6, 2023
1 task
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.

Support 'sni_hostname' extension with SOCKS proxy.
3 participants