Skip to content

Commit 81df78d

Browse files
committed
Get Now Accessible In data Attribute
1 parent af9071a commit 81df78d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/CyroWebB/Request.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ class request:
22
def __init__(self, _str):
33
self.method = _str.split(b"\r\n\r\n")[0].split(b"\r\n")[0].split(b" HTTP")[0].split(b" ")[0].decode("utf-8")
44
self.path = _str.split(b"\r\n\r\n")[0].split(b"\r\n")[0].split(b" HTTP")[0].split(b" ")[1].decode("utf-8")
5-
if '?' in self.path:
6-
self.get_string = self.path.split('?')[1]
7-
self.path = self.path.split('?')[0]
8-
if '&' in self.get_string:
9-
self.get_string = self.get_string.split('&')
10-
else
11-
self.get_string = [self.get_string]
12-
self.get_string = {k: v for k, v in (x.split('=') for x in self.get_string)}
135
self.headers = _str.split(b"\r\n\r\n")[0].split(b"\r\n")
146
headerL = {}
157
for header in self.headers:
@@ -31,6 +23,15 @@ def __init__(self, _str):
3123
if post_data == "":
3224
continue
3325
self.data["POST"][post_data.split(b"=")[0]] = cookie.split(b"=")[1]
26+
if '?' in self.path:
27+
self.get_string = self.path.split('?')[1]
28+
self.path = self.path.split('?')[0]
29+
if '&' in self.get_string:
30+
self.get_string = self.get_string.split('&')
31+
else
32+
self.get_string = [self.get_string]
33+
self.get_data = {k: v for k, v in (x.split('=') for x in self.get_string)}
34+
self.data["GET"] = self.get_data
3435
else:
3536
self.body = None
3637

0 commit comments

Comments
 (0)