Merge pull request #25 from xyzkab/fix_parse_method_action_uri
Fix parse method and action uripull/34/head
commit
fbfed08b0b
|
@ -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]
|
||||||
|
|
Loading…
Reference in New Issue