From 9b97511c831cb46a291f5355cc92f12120bc5921 Mon Sep 17 00:00:00 2001 From: Bung Date: Wed, 3 May 2023 21:45:45 +0800 Subject: [PATCH] fix warnings --- src/scorper/http/mofuparser.nim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/scorper/http/mofuparser.nim b/src/scorper/http/mofuparser.nim index 608e302..b5444f9 100644 --- a/src/scorper/http/mofuparser.nim +++ b/src/scorper/http/mofuparser.nim @@ -460,22 +460,22 @@ proc parseChunk*(mc: MofuChunk, buf: ptr char, bSize: var int): int = chunkExit() proc getMethod*(req: MofuParser): string {.inline.} = - result = ($(req.httpMethod))[0 .. req.httpMethodLen] + result = ($ cast[cstring](req.httpMethod))[0 .. req.httpMethodLen] proc getPath*(req: MofuParser): string {.inline.} = - result = ($(req.path))[0 .. req.pathLen] + result = ($ cast[cstring](req.path))[0 .. req.pathLen] proc getHeader*(req: MofuParser, name: string): string {.inline.} = for i in 0 ..< req.headerLen: - if ($(req.headers[i].name))[0 .. req.headers[i].namelen] == name: - result = ($(req.headers[i].value))[0 .. req.headers[i].valuelen] + if ($ cast[cstring](req.headers[i].name))[0 .. req.headers[i].namelen] == name: + result = ($ cast[cstring](req.headers[i].value))[0 .. req.headers[i].valuelen] return result = "" iterator headersPair*(req: MofuParser): tuple[name, value: string] = for i in 0 ..< req.headerLen: - yield (($(req.headers[i].name))[0 .. req.headers[i].namelen], - ($(req.headers[i].value))[0 .. req.headers[i].valuelen]) + yield (($ cast[cstring](req.headers[i].name))[0 .. req.headers[i].namelen], + ($ cast[cstring](req.headers[i].value))[0 .. req.headers[i].valuelen]) proc toHttpHeaders*(mhr: MofuParser): HttpHeaders = var hds: seq[tuple[key: string, val: string]] = @[]