summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorrockcavera <rockcavera@gmail.com>2021-02-22 13:40:57 -0300
committerGitHub <noreply@github.com>2021-02-22 17:40:57 +0100
commitd76d79336faef323744e9d22b99ec7a327b72cea (patch)
tree08047d4fc61a5a2877e7f4f0232cf65ba311b397 /tests
parent2aba116bbc8c1a595e49c8a703f2b8aecd7e8eda (diff)
downloadNim-d76d79336faef323744e9d22b99ec7a327b72cea.tar.gz
fix #15215 (#17142)
* fix 15215

* fix test

* end line

* Update tests/stdlib/tnetconnect.nim

Co-authored-by: flywind <xzsflywind@gmail.com>

* Update lib/pure/net.nim

Co-authored-by: flywind <xzsflywind@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/stdlib/tnetconnect.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/stdlib/tnetconnect.nim b/tests/stdlib/tnetconnect.nim
new file mode 100644
index 000000000..e27499651
--- /dev/null
+++ b/tests/stdlib/tnetconnect.nim
@@ -0,0 +1,22 @@
+discard """
+  cmd: "nim c -r -d:ssl $file"
+  exitcode: 0
+"""
+
+import std/net
+
+# Issue 15215 - https://github.com/nim-lang/Nim/issues/15215
+proc test() =
+  var
+    ctx = newContext()
+    socket = newSocket()
+
+  wrapSocket(ctx, socket)
+
+  connect(socket, "www.nim-lang.org", Port(443), 5000)
+
+  send(socket, "GET / HTTP/1.0\nHost: www.nim-lang.org\nConnection: close\n\n")
+
+  close(socket)
+
+test()