Skip to content

Commit

Permalink
whatever
Browse files Browse the repository at this point in the history
  • Loading branch information
guzba committed Feb 3, 2024
1 parent 870b340 commit e96af0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/puppy/platforms/linux/platform.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import libcurl, puppy/common, std/strutils, zippy
import libcurl, puppy/common, std/strutils, zippy, webby/httpheaders

block:
## If you did not already call curl_global_init then
Expand Down Expand Up @@ -106,7 +106,11 @@ proc internalFetch*(req: Request): Response {.raises: [PuppyError].} =
for headerLine in headerData.split(CRLF):
let arr = headerLine.split(":", 1)
if arr.len == 2:
result.headers.add((arr[0].strip(), arr[1].strip()))
when (NimMajor, NimMinor, NimPatch) >= (1, 4, 8):
result.add((arr[0].strip(), arr[1].strip()))
else:
let tmp = cast[ptr HttpHeaders](result.headers.addr)
tmp[].toBase.add((arr[0].strip(), arr[1].strip()))

result.body = bodyWrap.str
if result.headers["Content-Encoding"] == "gzip":
Expand Down
9 changes: 5 additions & 4 deletions src/puppy/platforms/win32/platform.nim
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ proc internalFetch*(req: Request): Response {.raises: [PuppyError].} =
if line != "":
let parts = line.split(":", 1)
if parts.len == 2:
result.headers.add((
parts[0].strip(),
parts[1].strip()
))
when (NimMajor, NimMinor, NimPatch) >= (1, 4, 8):
result.add((parts[0].strip(), parts[1].strip()))
else:
let tmp = cast[ptr HttpHeaders](result.headers.addr)
tmp[].toBase.add((parts[0].strip(), parts[1].strip()))

var i: int
result.body.setLen(8192)
Expand Down

0 comments on commit e96af0e

Please sign in to comment.