New submission from Mjbmr <[email protected]>:
A simple script, trying connect to second ssl through first sever doesn't work:
import socket, ssl
sock = socket.socket()
sock.connect(('<FIRST_SERVER>', 443))
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
sock = ctx.wrap_socket(sock)
sock.send(b'CONNECT <SECOND_SERVER>:443 HTTP/1.1\r\n\r\n')
print(sock.recv(1024))
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
sock = ctx.wrap_socket(sock)
sock.do_handshake()
sock.send(b'CONNECT ifconf.me:80 HTTP/1.1\r\n\r\n')
print(sock.recv(1024))
b'HTTP/1.1 200 Connection established\r\n\r\n'
Traceback (most recent call last):
File "C:\Users\Javad\Desktop\4.py", line 15, in <module>
sock = ctx.wrap_socket(sock)
File "E:\Categories\Python\Python3.9.6\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "E:\Categories\Python\Python3.9.6\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "E:\Categories\Python\Python3.9.6\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly
closed by the remote host
----------
assignee: christian.heimes
components: SSL
messages: 400291
nosy: christian.heimes, mjbmr
priority: normal
severity: normal
status: open
title: Two Layers of SSL/TLS
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45005>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com