tasyncorc.nim 550 B

123456789101112131415161718192021222324252627
  1. discard """
  2. output: '''230000'''
  3. cmd: '''nim c --gc:orc -d:useMalloc $file'''
  4. valgrind: "leaks"
  5. """
  6. # bug #14402
  7. import asynchttpserver, asyncdispatch, httpclient, strutils
  8. proc cb(req: Request) {.async, gcsafe.} =
  9. const html = " ".repeat(230000)
  10. await req.respond(Http200, html)
  11. var server = newAsyncHttpServer()
  12. asyncCheck server.serve(Port(8080), cb)
  13. proc test {.async.} =
  14. var
  15. client = newAsyncHttpClient()
  16. resp = await client.get("http://localhost:8080")
  17. let x = (await resp.body).len
  18. echo x # crash
  19. waitFor test()