Created
January 24, 2019 11:05
-
-
Save wwj718/400ed5ab68c45e62ed0c9bf1c7010dfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3 | |
''' | |
Usage: | |
openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes | |
python3 simple_https_server.py | |
''' | |
import http.server, ssl | |
server_address = ('localhost', 8601) | |
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler) | |
httpd.socket = ssl.wrap_socket(httpd.socket, | |
server_side=True, | |
certfile='server.pem', | |
ssl_version=ssl.PROTOCOL_TLSv1) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment