January 2019
Beginner to intermediate
776 pages
19h 58m
English
After placing a certificate file on the current working folder, we can create a web server that makes use of this certificate to serve encrypted content to the clients.
Listing 4.10 explains the code for a secure HTTP server as follows:
#!/usr/bin/env python # Python Network Programming Cookbook -- Chapter - 4 # This program requires Python 3.5.2 or any later version # It may run on any other version with/without modifications. # # Follow the comments inline to make it run on Python 2.7.x. # Requires pyOpenSSL and SSL packages installed import socket, os from OpenSSL import SSL from socketserver import BaseServer from http.server import HTTPServer from http.server import SimpleHTTPRequestHandler # Comment out the above 3 lines ...
Read now
Unlock full access