0

我需要通过套接字使用 https 连接(使用 socks 代理),我正在尝试使用 ssl 但出现错误:

>>> import socket
>>> import ssl
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(("www.google.com.ua",443))
>>> ss=ssl.wrap_socket(s)
Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    ss=ssl.wrap_socket(s)
  File "/usr/lib/python3.2/ssl.py", line 521, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python3.2/ssl.py", line 276, in __init__
    raise x
  File "/usr/lib/python3.2/ssl.py", line 272, in __init__
    self.do_handshake()
  File "/usr/lib/python3.2/ssl.py", line 451, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:392: EOF occurred in violation of protocol

我怎样才能使它正确?提前谢谢。

4

0 回答 0