Typically when interfacing with C I'd recommend using `c*` types, in this case
`culong`. Nim and C have different integer sizing rules, so using `uint` may
not be correct for all architectures.
I found a solution (on Linux at least) In the zlib.nim file, where types are
defines at the top of the file, change Ulong* = uint32 to Ulong* = uint
Also set the 'level' parameter of the compress proc to 'Z_DEFLATED'.
I wrapped the minz package. Unfortunately minz is not gzip compatible that is
needed by http.
I think but i am not 100%, but you might need to use the gzlipfiles protocol:
[https://github.com/nim-lang/zip/blob/master/zip/gzipfiles.nim](https://github.com/nim-lang/zip/blob/master/zip/gzipfiles.ni
Not work with miniz package. The browser show the following message:
This site can’t be reached The webpage at http://127.0.0.1:8080/ might be
temporarily
down or it may have moved permanently to a new web address.
ERR_CONTENT_DECODING_FAILED
Try miniz instead.
[https://github.com/treeform/miniz](https://github.com/treeform/miniz)
zip/zlib.nim defines ulong as 32-bit, so it fails with 64-bit zlibs.
I am trying to compress the responses that are sent by http:
import asynchttpserver, asyncdispatch
import zip/zlib
proc handle(req: Request) {.async.} =
if req.headers.hasKey("Accept-Encoding") and
req.headers["Accept-Encoding"] == "gzip":
let headers = new