Merge branch 'starttls' of https://github.com/wiml/Nim into wiml-starttls

Conflicts:
	lib/pure/net.nim
This commit is contained in:
Dominik Picheta 2015-06-22 21:34:21 +01:00
commit 8853dfb353
2 changed files with 89 additions and 53 deletions

View file

@ -472,6 +472,15 @@ when defined(ssl):
socket.bioOut = bioNew(bio_s_mem())
sslSetBio(socket.sslHandle, socket.bioIn, socket.bioOut)
proc wrapSocket*(ctx: SslContext, socket: AsyncSocket, handshake: SslHandshakeType) =
wrapSocket(ctx, socket)
case handshake
of handshakeAsClient:
sslSetConnectState(socket.sslHandle)
of handshakeAsServer:
sslSetAcceptState(socket.sslHandle)
proc getSockOpt*(socket: AsyncSocket, opt: SOBool, level = SOL_SOCKET): bool {.
tags: [ReadIOEffect].} =
## Retrieves option ``opt`` as a boolean value.