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 = newHttpHeaders([("Content-Encoding", "gzip")])
        await req.respond(Http200, compress("Yes, it was compressed!"), headers)
      else:
        await req.respond(Http200, "Compress me please!...")
    
    var server = newAsyncHttpServer()
    waitFor server.serve(Port(8080), handle)
    
    
    Run

But I get the following error message when trying to run this code!
    
    
    Exception message: zlib version mismatch!
    Exception type: [ZlibStreamError]
    Error: execution of an external program failed: '/home/hdias/dev/server '

What's is wrong? and how can I get it to work? (my zlib version: 
zlib-1:1.2.11-3) 

Reply via email to