Update 'advancedhttpserver.py'

This commit is contained in:
jens 2020-11-03 00:19:14 +00:00
parent 704bb894b0
commit af988817a0
1 changed files with 4 additions and 1 deletions

View File

@ -5,6 +5,8 @@ this builds on simple http server
Author: jens (gitea.caret.be)
you'll need `pip install pyOpenSSL` for now if you want the ssl feature
license: gpl-v3
"""
@ -21,7 +23,6 @@ import io
import ssl
import base64
from getpass import getpass
from OpenSSL.crypto import load_certificate, FILETYPE_PEM
BYTE_RANGE_RE = re.compile(r'bytes=(\d+)-(\d+)?$')
KEYFILE = 'yourkeyfile.key'
@ -351,6 +352,8 @@ def test(HandlerClass=RangeRequestHandler):
def runssl(keyfile):
from OpenSSL.crypto import load_certificate, FILETYPE_PEM
httpd = HTTPServer(('0.0.0.0', 4443), RangeRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, certfile=keyfile)
print('visit https://0.0.0.0:4443/')