summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorDaehee <hello@daehee.com>2021-01-22 07:04:52 -0700
committerGitHub <noreply@github.com>2021-01-22 15:04:52 +0100
commit2d0cb18b9f092fad54abefed475218ae92fc846c (patch)
tree1b6fadeff534eaab8a41cf429520ef50609c07d4 /tests
parentbebfbaa439194a15a9630d0e86ed677dde27c372 (diff)
downloadNim-2d0cb18b9f092fad54abefed475218ae92fc846c.tar.gz
Fix SIGSEGV in httpclient response body (#16766)
* initialize httpclient response bodyStream; prevent SIGSEGV when getBody is false

* Update lib/pure/httpclient.nim

* Update lib/pure/httpclient.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/thttpclient.nim6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/stdlib/thttpclient.nim b/tests/stdlib/thttpclient.nim
index 0cef10e6d..e81590d95 100644
--- a/tests/stdlib/thttpclient.nim
+++ b/tests/stdlib/thttpclient.nim
@@ -148,6 +148,12 @@ proc syncTest() =
 
   client.close()
 
+  # SIGSEGV on HEAD body read: issue #16743
+  block:
+    let client = newHttpClient()
+    let resp = client.head("http://httpbin.org/head")
+    doAssert(resp.body == "")
+
   when false:
     # Disabled for now because it causes troubles with AppVeyor
     # Timeout test.