diff options
author | Araq <rumpf_a@web.de> | 2011-09-24 20:22:53 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-09-24 20:22:53 +0200 |
commit | 0f37d0e1f2aeee466b3c6179886963354eaa6222 (patch) | |
tree | 51ae4183dabd454877d7570cafb7f72dcf519011 /lib/pure/httpclient.nim | |
parent | 485c371942cbbb1f9a10c64b6fcc699e59511460 (diff) | |
download | Nim-0f37d0e1f2aeee466b3c6179886963354eaa6222.tar.gz |
sockets.recv optimizations; stdlib now supports taint mode
Diffstat (limited to 'lib/pure/httpclient.nim')
-rwxr-xr-x | lib/pure/httpclient.nim | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/pure/httpclient.nim b/lib/pure/httpclient.nim index 73a8cb853..3af08f040 100755 --- a/lib/pure/httpclient.nim +++ b/lib/pure/httpclient.nim @@ -75,7 +75,7 @@ proc fileError(msg: string) = proc charAt(d: var string, i: var int, s: TSocket): char {.inline.} = result = d[i] while result == '\0': - d = s.recv() + d = string(s.recv()) i = 0 result = d[i] @@ -98,7 +98,7 @@ proc parseChunks(d: var string, start: int, s: TSocket): string = digitFound = true chunkSize = chunkSize shl 4 or (ord(d[i]) - ord('A') + 10) of '\0': - d = s.recv() + d = string(s.recv()) i = -1 else: break inc(i) @@ -123,7 +123,7 @@ proc parseChunks(d: var string, start: int, s: TSocket): string = inc(L, bytesRead) dec(missing, bytesRead) # next chunk: - d = s.recv() + d = string(s.recv()) i = 0 # skip trailing CR-LF: while charAt(d, i, s) in {'\C', '\L'}: inc(i) @@ -139,7 +139,7 @@ proc parseBody(d: var string, start: int, s: TSocket, var contentLengthHeader = headers["Content-Length"] if contentLengthHeader != "": var length = contentLengthHeader.parseint() - while result.len() < length: result.add(s.recv()) + while result.len() < length: result.add(s.recv.string) else: # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.4 TODO @@ -147,12 +147,12 @@ proc parseBody(d: var string, start: int, s: TSocket, # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5 if headers["Connection"] == "close": while True: - var moreData = recv(s) + var moreData = recv(s).string if moreData.len == 0: break result.add(moreData) proc parseResponse(s: TSocket): TResponse = - var d = s.recv() + var d = s.recv.string var i = 0 # Parse the version |