about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-23 21:09:31 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-23 21:09:31 +0300
commitac08c5e84153160f8221b30854a9b7029b8c3fe2 (patch)
treee902f6a095996c864b6abf4f9c0929a395053e81
parentfb24bdfccedcc95e9cdfb97db375120933bb451c (diff)
downloadhttpy-ac08c5e84153160f8221b30854a9b7029b8c3fe2.tar.gz
httpy-ac08c5e84153160f8221b30854a9b7029b8c3fe2.zip
Update API
-rw-r--r--src/APIv1.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/APIv1.py b/src/APIv1.py
index 882a13d..c9ba2da 100644
--- a/src/APIv1.py
+++ b/src/APIv1.py
@@ -65,13 +65,11 @@ def api_call(client: SSLSocket, request: Request) -> Response:
     """
 
     # decode API request
-    split_path = request.path.split("/")
-    api_level1 = split_path[2]
-    api_request = split_path[3]
+    split_path = request.path.split("/", maxsplit=16)[1:]
 
     # do something with it (oh god)
-    if api_level1 == "file":
-        if api_request == "random":
+    if len(split_path) > 1 and split_path[1] == "file":
+        if len(split_path) > 2 and split_path[2] == "random":
             # get size
             size_str = request.path_args.get("size", "16mib")
             size = decode_size(size_str)