about summary refs log tree commit diff
path: root/src/request.py
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-25 03:13:45 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-25 03:13:45 +0300
commit619f5707b95b3ff13047f6114e8b89ef665b1100 (patch)
treed507a6671e758a6399584f276eda83ef29240082 /src/request.py
parent93317bcd56a39fc70020143d6f4e6a615a45111f (diff)
downloadhttpy-619f5707b95b3ff13047f6114e8b89ef665b1100.tar.gz
httpy-619f5707b95b3ff13047f6114e8b89ef665b1100.zip
Add UTF-8 support
Probably useful to have it
Diffstat (limited to 'src/request.py')
-rw-r--r--src/request.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/request.py b/src/request.py
index 6c5b9d5..8f5a6a8 100644
--- a/src/request.py
+++ b/src/request.py
@@ -25,8 +25,8 @@ class Request:
         request = Request()
 
         # change type and path
-        request.type = raw_request[:raw_request.find(b' ')].decode("ascii")
-        raw_path = raw_request[len(request.type)+1:raw_request.find(b' ', len(request.type)+1)].decode("ascii")
+        request.type = raw_request[:raw_request.find(b' ')].decode("utf8")
+        raw_path = raw_request[len(request.type)+1:raw_request.find(b' ', len(request.type)+1)].decode("utf8")
 
         # remove path args from path
         request.path = raw_path.split("?")[0]
@@ -47,7 +47,7 @@ class Request:
 
         # decode headers
         for raw_header in raw_request.split(b'\r\n'):
-            if len(pair := raw_header.decode("ascii").split(":")) == 2:
+            if len(pair := raw_header.decode("utf8").split(":")) == 2:
                 key, val = pair
                 val = val.strip()