resolved conflicts with master
This commit is contained in:
commit
36afdca87f
22 changed files with 225 additions and 611 deletions
|
|
@ -233,8 +233,11 @@ proc asyncSockHandleWrite(h: PObject) =
|
|||
let sock = PAsyncSocket(h)
|
||||
try:
|
||||
let bytesSent = sock.socket.sendAsync(sock.sendBuffer)
|
||||
assert bytesSent > 0
|
||||
if bytesSent != sock.sendBuffer.len:
|
||||
if bytesSent == 0:
|
||||
# Apparently the socket cannot be written to. Even though select
|
||||
# just told us that it can be... This used to be an assert. Just
|
||||
# do nothing instead.
|
||||
elif bytesSent != sock.sendBuffer.len:
|
||||
sock.sendBuffer = sock.sendBuffer[bytesSent .. -1]
|
||||
elif bytesSent == sock.sendBuffer.len:
|
||||
sock.sendBuffer = ""
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -387,6 +387,14 @@ proc existsDir*(dir: string): bool {.rtl, extern: "nos$1", tags: [FReadDir].} =
|
|||
var res: TStat
|
||||
return stat(dir, res) >= 0'i32 and S_ISDIR(res.st_mode)
|
||||
|
||||
proc fileExists*(filename: string): bool {.inline.} =
|
||||
## Synonym for existsFile
|
||||
existsFile(filename)
|
||||
|
||||
proc dirExists*(dir: string): bool {.inline.} =
|
||||
## Synonym for existsDir
|
||||
existsDir(dir)
|
||||
|
||||
proc getLastModificationTime*(file: string): TTime {.rtl, extern: "nos$1".} =
|
||||
## Returns the `file`'s last modification time.
|
||||
when defined(posix):
|
||||
|
|
|
|||
|
|
@ -132,6 +132,10 @@ proc toUTF8*(c: TRune): string {.rtl, extern: "nuc$1".} =
|
|||
result = newString(1)
|
||||
result[0] = chr(i)
|
||||
|
||||
proc `$`*(rune: TRune): string =
|
||||
## converts a rune to a string
|
||||
rune.toUTF8
|
||||
|
||||
proc `$`*(runes: seq[TRune]): string =
|
||||
## converts a sequence of runes to a string
|
||||
result = ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue