summary refs log tree commit diff stats
path: root/tests/stdlib/tnetconnect.nim
blob: e274996512e792b72fe448f20cc8c00e22441744 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()