This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mjbmr
Recipients christian.heimes, mjbmr
Date 2021-08-25.19:25:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1629919556.77.0.871117984975.issue45005@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-08-25 19:25:56mjbmrsetrecipients: + mjbmr, christian.heimes
2021-08-25 19:25:56mjbmrsetmessageid: <1629919556.77.0.871117984975.issue45005@roundup.psfhosted.org>
2021-08-25 19:25:56mjbmrlinkissue45005 messages
2021-08-25 19:25:56mjbmrcreate