Skip to content

Commit 89ab783

Browse files
committed
Update utils.py
1 parent 0c4a56a commit 89ab783

File tree

1 file changed

+0
-62
lines changed

1 file changed

+0
-62
lines changed

src/utils.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,65 +15,3 @@ def writejson(data, path):
1515
f = open("./data/" + path + ".json", 'w')
1616
json.dump(data, f)
1717
f.close()
18-
19-
def http_parser_request(html_string):
20-
21-
map = dict()
22-
html_string = html_string.split('\r\n')
23-
24-
map['body'] = dict()
25-
26-
first = True
27-
is_body = False
28-
29-
for i in (html_string):
30-
if (first):
31-
i = i.split(' ')
32-
map['Method'] = i[0]
33-
map['Path'] = i[1]
34-
map['Version'] = i[2]
35-
first = False
36-
37-
elif not is_body:
38-
if (i == ''):
39-
is_body = True
40-
else:
41-
i = i.split(':')
42-
map[i[0]] = i[1]
43-
44-
else:
45-
i = i.replace('"', '').split(':')
46-
if (len(i) > 1):
47-
map['body'][i[0]] = i[1]
48-
49-
return map
50-
51-
def http_parser_reply(html_string):
52-
53-
map = dict()
54-
html_string = html_string.split('\r\n')
55-
56-
map['body'] = ''
57-
58-
first = True
59-
is_body = False
60-
61-
for i in (html_string):
62-
if (first):
63-
i = i.split(' ')
64-
map['Version'] = i[0]
65-
map['Status Code'] = i[1]
66-
map['Status Message'] = i[2]
67-
first = False
68-
69-
elif not is_body:
70-
if (i == ''):
71-
is_body = True
72-
else:
73-
i = i.split(':')
74-
map[i[0]] = i[1]
75-
76-
else:
77-
map['body'] += i +'\n'
78-
79-
return map

0 commit comments

Comments
 (0)