Merge pull request #25 from xyzkab/fix_parse_method_action_uri

Fix parse method and action uri
pull/34/head
Swissky 2020-01-28 17:31:49 +01:00 committed by GitHub
commit fbfed08b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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:
@ -150,4 +150,4 @@ class Requester(object):
text += "\n\n" text += "\n\n"
for data in self.data: for data in self.data:
text += data + "=" + self.data[data] + "&" text += data + "=" + self.data[data] + "&"
return text[:-1] return text[:-1]