Revert "improvements for httpcore (#12228)"

This reverts commit b865c2a54b.
This commit is contained in:
narimiran 2019-09-23 19:06:55 +02:00
commit f7a8fc46c0
4 changed files with 44 additions and 46 deletions

View file

@ -78,7 +78,7 @@ proc sendHeaders*(req: Request, headers: HttpHeaders): Future[void] =
return req.client.send(msg)
proc respond*(req: Request, code: HttpCode, content: string,
headers = EmptyHttpHeaders): Future[void] =
headers: HttpHeaders = nil): Future[void] =
## Responds to the request with the specified ``HttpCode``, headers and
## content.
##
@ -97,7 +97,7 @@ proc respond*(req: Request, code: HttpCode, content: string,
## await req.respond(Http404, "Not Found")
var msg = "HTTP/1.1 " & $code & "\c\L"
if isEmpty(headers):
if headers != nil:
msg.addHeaders(headers)
msg.add("Content-Length: ")
# this particular way saves allocations: