Last header not being copied in parser.py for GET

In method create_request of class RequestCreator in file
syntribos/clients/http/parser.py line 43, the headers variable
is missing the last HTTP header when a GET file is being processed.
The code works for POST because the POST body is separated from the
header by two newlines. For GET requests, the index value is being
adjusted to account for the fact that it does not have a body so no
empty line will be present.  We just add 1 to the index in that case.

Change-Id: I91881e1882aab21c2c14a7ff351bb3f7b70727f2
Closes-Bug: #1543236
This commit is contained in:
Henry Yamauchi 2016-02-08 15:50:53 -06:00
parent 1ad29ce562
commit 0420f10d4c
1 changed files with 2 additions and 0 deletions

View File

@ -39,6 +39,8 @@ class RequestCreator(object):
for index, line in enumerate(lines):
if line == "":
break
if lines[index] != "":
index = index + 1
method, url, params, version = cls._parse_url_line(lines[0], endpoint)
headers = cls._parse_headers(lines[1:index])
data = cls._parse_data(lines[index + 1:])