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() exit()
try: try:
content = content.split('\n')
# Parse method and action URI # Parse method and action URI
regex = re.compile('(.*) (.*) HTTP') regex = re.compile('(.*) (.*) HTTP')
self.method, self.action = regex.findall(content)[0] self.method, self.action = regex.findall(content[0])[0]
# Parse headers # Parse headers
content = content.split('\n')
for header in content[1:]: for header in content[1:]:
name, _, value = header.partition(': ') name, _, value = header.partition(': ')
if not name or not value: if not name or not value: