move up content.split, use content[0] on regex.findall

pull/25/head
xyzkab 2020-01-28 20:00:04 +07:00
parent bb0fe7d9dd
commit 394df12bb9
1 changed files with 3 additions and 3 deletions

View File

@ -22,12 +22,12 @@ class Requester(object):
exit()
try:
content = content.split('\n')
# Parse method and action URI
regex = re.compile('(.*) (.*) HTTP')
self.method, self.action = regex.findall(content)[0]
self.method, self.action = regex.findall(content[0])[0]
# Parse headers
content = content.split('\n')
for header in content[1:]:
name, _, value = header.partition(': ')
if not name or not value:
@ -150,4 +150,4 @@ class Requester(object):
text += "\n\n"
for data in self.data:
text += data + "=" + self.data[data] + "&"
return text[:-1]
return text[:-1]