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

SSL + NordVPN Proxy #2632

Closed
kkm opened this issue Mar 23, 2023 · 2 comments
Closed

SSL + NordVPN Proxy #2632

kkm opened this issue Mar 23, 2023 · 2 comments

Comments

@kkm
Copy link

kkm commented Mar 23, 2023

proxy.py:

import httpx
proxy = httpx.Proxy(f"https://user:password@al30.nordvpn.com:89")
proxies = {
    "http://": proxy,
    "https://": proxy,
}
client = httpx.Client(proxies=proxies)
response = client.get("https://www.example.com")
print(response.text)
client.close()

output from the error:


$python proxy.py 
Traceback (most recent call last):
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_exceptions.py", line 339, in map_exceptions
    yield
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 854, in _send_single_request
    (status_code, headers, stream, ext) = transport.request(
  File "/home/kkm/.local/lib/python3.8/site-packages/httpcore/_sync/http_proxy.py", line 124, in request
    return self._tunnel_request(
  File "/home/kkm/.local/lib/python3.8/site-packages/httpcore/_sync/http_proxy.py", line 232, in _tunnel_request
    proxy_connection.start_tls(host, timeout)
  File "/home/kkm/.local/lib/python3.8/site-packages/httpcore/_sync/connection.py", line 161, in start_tls
    self.socket = self.connection.start_tls(hostname, timeout)
  File "/home/kkm/.local/lib/python3.8/site-packages/httpcore/_sync/http11.py", line 87, in start_tls
    self.socket = self.socket.start_tls(hostname, self.ssl_context, timeout)
  File "/home/kkm/.local/lib/python3.8/site-packages/httpcore/_backends/sync.py", line 49, in start_tls
    wrapped = ssl_context.wrap_socket(
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/kkm/.local/lib/python3.8/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
    raise to_exc(exc) from None
httpcore.ConnectError: [SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:1131)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "proxy.py", line 18, in <module>
    response = client.get("https://www.example.com")
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 900, in get
    return self.request(
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 721, in request
    return self.send(
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 753, in send
    response = self._send_handling_auth(
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 791, in _send_handling_auth
    response = self._send_handling_redirects(
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 823, in _send_handling_redirects
    response = self._send_single_request(request, timeout)
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_client.py", line 854, in _send_single_request
    (status_code, headers, stream, ext) = transport.request(
  File "/usr/lib/python3.8/contextlib.py", line 131, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/kkm/.local/lib/python3.8/site-packages/httpx/_exceptions.py", line 356, in map_exceptions
    raise mapped_exc(message, **kwargs) from exc  # type: ignore
httpx.ConnectError: [SSL: UNEXPECTED_MESSAGE] unexpected message (_ssl.c:1131)

Linux: Ubuntu 20.04 focal
Python 3.8.10

I am not sure if I am wrong with my code or SSL bug?

@byehack
Copy link

byehack commented Mar 28, 2023

same as #1373
try #1434 (comment)

@tomchristie
Copy link
Member

duplicate of #1434.

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

No branches or pull requests

3 participants