diff options
| author | UltraQbik <no1skill@yandex.ru> | 2024-08-23 02:24:11 +0300 |
|---|---|---|
| committer | UltraQbik <no1skill@yandex.ru> | 2024-08-23 02:24:11 +0300 |
| commit | d9cc26c6a545e110615957890f36163dff4db7c0 (patch) | |
| tree | 8bc4886cb220c668736107c6074e808d8cdb5a2c /main.py | |
| parent | ec5d5d02798ee43aa0af1a26a170deaeb722e34f (diff) | |
| download | httpy-d9cc26c6a545e110615957890f36163dff4db7c0.tar.gz httpy-d9cc26c6a545e110615957890f36163dff4db7c0.zip | |
Change path map a bit
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 49 |
1 files changed, 9 insertions, 40 deletions
diff --git a/main.py b/main.py index 0b9f991..f68f6dd 100644 --- a/main.py +++ b/main.py @@ -13,36 +13,23 @@ from src import APIv1 from src.socks import * from src.request import Request from src.minimizer import minimize_html +from src.status_code import * # path mapping PATH_MAP = { - "/": - {"path": "www/index.html", - "compress": True}, - "/index.html": - {"path": "www/index.html", - "compress": True}, - "/robots.txt": - {"path": "www/robots.txt", - "compress": False}, - "/favicon.ico": - {"path": "www/favicon.ico", - "compress": False}, - "/css/styles.css": - {"path": "css/styles.css", - "compress": True}, - "/about": - {"path": "www/about.html", - "compress": True}, - "/test": - {"path": "www/test.html", - "compress": True}, + "/": {"path": "www/index.html"}, + "/index.html": {"path": "www/index.html"}, + "/robots.txt": {"path": "www/robots.txt"}, + "/favicon.ico": {"path": "www/favicon.ico"}, + "/css/styles.css": {"path": "css/styles.css"}, + "/about": {"path": "www/about.html"}, + "/test": {"path": "www/test.html"}, } # API API_VERSIONS = { - "APIv1" + "APIv1": {"supported": True} } # internal path map @@ -51,24 +38,6 @@ I_PATH_MAP = { } -def get_response_code(code: int) -> bytes: - match code: - case 200: - return b'200 OK' - case 400: - return b'400 Bad Request' - case 401: - return b'401 Unauthorized' - case 403: - return b'403 Forbidden' - case 404: - return b'404 Not Found' - case 6969: - return b'6969 UwU' - case _: # in any other case return bad request response - return get_response_code(400) - - class HTTPServer: """ The mighty HTTP server |