发布时间:2019-09-22 08:09:12编辑:auto阅读(1756)
1.配置IIS
2.客户端安装SSL访问web服务器
#!/usr/bin/env python
import socket, sys
def sendall(s, buf):
byteswritten = 0
while byteswritten < len(buf):
byteswritten += s.write(buf[byteswritten:])
print "Creating socket...",
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print "done."
print "Connecting to remote host...",
s.connect(("127.0.0.1", 443))
print "done."
print "Establishing SSL...",
ssl = socket.ssl(s)
print "done."
print "Requesting document...",
sendall(ssl, "GET / HTTP/1.0\r\n\r\n")
print "done."
s.shutdown(1)
while 1:
try:
buf = ssl.read(1024)
except socket.sslerror, err:
if (err[0]) in [socket.SSL_ERROR_ZERO_RETURN, socket.SSL_ERROR_EOF]:
break
elif (err[0]) in [socket.SSL_ERROR_WANT_READ,
socket.SSL_ERROR_WANT_WRITE]:
continue
raise
if len(buf) == 0:
break
sys.stdout.write(buf)
s.close()
上一篇: Python 代码跳转
下一篇: Python操作Hive的两种方法总结
47827
46356
37249
34709
29297
25956
24868
19930
19508
17996
5774°
6397°
5908°
5952°
7052°
5896°
5926°
6420°
6386°
7754°