Merge remote-tracking branch 'origin/devel' into appveyor

This commit is contained in:
Aman Gupta 2015-10-13 16:14:19 -07:00
commit 6e8cb658c3
3 changed files with 9 additions and 9 deletions

View file

@ -1155,7 +1155,7 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
let field = lookupFieldAgain(p, ty, it.sons[0].sym, tmp2.r) let field = lookupFieldAgain(p, ty, it.sons[0].sym, tmp2.r)
if field.loc.r == nil: internalError(e.info, "genObjConstr") if field.loc.r == nil: internalError(e.info, "genObjConstr")
if it.len == 3 and optFieldCheck in p.options: if it.len == 3 and optFieldCheck in p.options:
genFieldCheck(p, it.sons[2], tmp2.r, field, ty) genFieldCheck(p, it.sons[2], r, field, ty)
add(tmp2.r, ".") add(tmp2.r, ".")
add(tmp2.r, field.loc.r) add(tmp2.r, field.loc.r)
tmp2.k = locTemp tmp2.k = locTemp

View file

@ -166,12 +166,12 @@ proc parseChunks(s: Socket, timeout: int): string =
proc parseBody(s: Socket, headers: StringTableRef, timeout: int): string = proc parseBody(s: Socket, headers: StringTableRef, timeout: int): string =
result = "" result = ""
if headers["Transfer-Encoding"] == "chunked": if headers.getOrDefault"Transfer-Encoding" == "chunked":
result = parseChunks(s, timeout) result = parseChunks(s, timeout)
else: else:
# -REGION- Content-Length # -REGION- Content-Length
# (http://tools.ietf.org/html/rfc2616#section-4.4) NR.3 # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.3
var contentLengthHeader = headers["Content-Length"] var contentLengthHeader = headers.getOrDefault"Content-Length"
if contentLengthHeader != "": if contentLengthHeader != "":
var length = contentLengthHeader.parseint() var length = contentLengthHeader.parseint()
if length > 0: if length > 0:
@ -190,7 +190,7 @@ proc parseBody(s: Socket, headers: StringTableRef, timeout: int): string =
# -REGION- Connection: Close # -REGION- Connection: Close
# (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5 # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5
if headers["Connection"] == "close": if headers.getOrDefault"Connection" == "close":
var buf = "" var buf = ""
while true: while true:
buf = newString(4000) buf = newString(4000)
@ -456,7 +456,7 @@ proc redirection(status: string): bool =
return true return true
proc getNewLocation(lastUrl: string, headers: StringTableRef): string = proc getNewLocation(lastUrl: string, headers: StringTableRef): string =
result = headers["Location"] result = headers.getOrDefault"Location"
if result == "": httpError("location header expected") if result == "": httpError("location header expected")
# Relative URLs. (Not part of the spec, but soon will be.) # Relative URLs. (Not part of the spec, but soon will be.)
let r = parseUri(result) let r = parseUri(result)
@ -679,12 +679,12 @@ proc parseChunks(client: AsyncHttpClient): Future[string] {.async.} =
proc parseBody(client: AsyncHttpClient, proc parseBody(client: AsyncHttpClient,
headers: StringTableRef): Future[string] {.async.} = headers: StringTableRef): Future[string] {.async.} =
result = "" result = ""
if headers["Transfer-Encoding"] == "chunked": if headers.getOrDefault"Transfer-Encoding" == "chunked":
result = await parseChunks(client) result = await parseChunks(client)
else: else:
# -REGION- Content-Length # -REGION- Content-Length
# (http://tools.ietf.org/html/rfc2616#section-4.4) NR.3 # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.3
var contentLengthHeader = headers["Content-Length"] var contentLengthHeader = headers.getOrDefault"Content-Length"
if contentLengthHeader != "": if contentLengthHeader != "":
var length = contentLengthHeader.parseint() var length = contentLengthHeader.parseint()
if length > 0: if length > 0:
@ -699,7 +699,7 @@ proc parseBody(client: AsyncHttpClient,
# -REGION- Connection: Close # -REGION- Connection: Close
# (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5 # (http://tools.ietf.org/html/rfc2616#section-4.4) NR.5
if headers["Connection"] == "close": if headers.getOrDefault"Connection" == "close":
var buf = "" var buf = ""
while true: while true:
buf = await client.socket.recvFull(4000) buf = await client.socket.recvFull(4000)

View file

@ -24,7 +24,7 @@ var b = Bar(x: 100, y: 200) # used to fail
# bug 1275 # bug 1275
type type
Graphic = object of TObject Graphic = object of RootObj
case kind: range[0..1] case kind: range[0..1]
of 0: of 0:
radius: float radius: float