Доработка. Рефактор

This commit is contained in:
sasha80
2025-11-08 11:04:31 +03:00
parent 379504994c
commit 91b79266df
2 changed files with 19 additions and 0 deletions

2
generate-sertificate.sh Normal file
View File

@@ -0,0 +1,2 @@
#openssl req -x509 -newkey rsa:4096 -keyout key.pem -nodes -out cert.pem -sha256 -days 365 -subj "/C=RU/ST=NTC/L=TNIIS/O=Company Name/OU=Org/CN=www.example.com"
openssl req -new -x509 -keyout "html/server.pem" -out "html/server.pem" -days 365 -nodes

17
https-server.py Normal file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env python3
from http import server # Python 3
import ssl
import os
class MyHTTPRequestHandler(server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if __name__ == '__main__':
html_dir = os.path.join(os.path.dirname(__file__), 'html')
os.chdir(html_dir)
srv = server.HTTPServer(('', 8000), MyHTTPRequestHandler)
sdc = ssl.create_default_context()
srv.serve_forever()