httpclient: strip trailing whitespace from headers.

- we can do that according to the RFC.
- fixes #783
This commit is contained in:
Michał Zieliński
2013-12-28 17:07:52 +01:00
committed by Michał Zieliński
parent be5e13671c
commit 0420c8c363

View File

@@ -220,9 +220,8 @@ proc parseResponse(s: TSocket, getBody: bool, timeout: int): TResponse =
inc(linei, le)
if line[linei] != ':': httpError("invalid headers")
inc(linei) # Skip :
linei += skipWhitespace(line, linei)
result.headers[name] = line[linei.. -1]
result.headers[name] = line[linei.. -1].strip()
if not fullyRead:
httpError("Connection was closed before full request has been made")
if getBody: