HTTPS Server - Python2
来源:互联网 发布:ant java 版本 编辑:程序博客网 时间:2024/04/29 17:48
#!/usr/bin/env pythonfrom BaseHTTPServer import BaseHTTPRequestHandler,HTTPServerimport sslimport osclass HTTPRequestHandler(BaseHTTPRequestHandler): def setup(self): SSLSocket = ssl.wrap_socket(self.request,server_side=True, keyfile="key.pem", certfile="cert.pem",ca_certs="ca.crt",ssl_version=ssl.PROTOCOL_TLSv1) self.rfile = SSLSocket.makefile('rb', self.rbufsize) self.wfile = SSLSocket.makefile('wb', self.wbufsize) def do_GET(self): req_time = int(time.time()) clt_IP = self.client_address[0] self.protocol_version = "HTTP/1.1" self.server_version = "CenterServiceMock" self.send_response(200) self.end_headers() self.wfile.write("This is ServiceSerice %s"%clt_IP)if __name__=='__main__': server = HTTPServer(('',443),HTTPRequestHandler) #Thread.server.serve_forever() import thread thread.start_new_thread(server.serve_forever,())
0 0
- HTTPS Server - Python2
- HTTPS Server - Python2
- https server
- nginx 配置https server
- Simple Java HTTPS server
- python: https server sample
- android 搭建https Server
- golang https server
- IBM HTTP Server https configuration
- https server with openssl 笔记
- python https server and client
- 小程序server- 搭建HTTPS server
- python2
- Python2
- Python2
- python2
- python2
- Python2
- Mac下启动和停止Mysql服务
- ubuntu/debian使用apt-spy查找最快的源
- 线程同步的方法总结
- NFS文件系统挂载(服务器端+客户端)
- Pat(Advanced Level)Practice--1017(Queueing at Bank)
- HTTPS Server - Python2
- linux内核 asmlinkage宏
- linux 命令之 rm,rmdir 详解
- POJ3181 Dollar Dayz
- 每天一个C++小程序(十九)--桶排序
- 不要一辈子靠技术生存
- Simple HTTP Server and Client in Python
- python在windows下安装第三方库
- VC++小技巧-Output窗口输出定位 .