When trying to use this library, I get a error:1420C114:SSL routines:ssl_write_internal:uninitialized, whenever I use any proc, which uses sendLine, which essentially is just a imap.sock.send(line & CRLF).
This is how the AsyncSocket & SSL Context is initialised.
proc newImapClient*(cb: StatusCallback): ImapClient =
## Create a new Imap instance
result = ImapClient(
sslContext: net.newContext(verifyMode = CVerifyNone),
sock: newAsyncSocket(),
tagCallbacks: initTable[string, LineCallback](4),
anyCallbacks: initDeque[LineCallback](4),
statCb: cb
)
wrapSocket(result.sslContext, result.sock)
reset result.status
How can this be fixed?
Did you compile with -d:ssl?
Well, yes, else I would get a compilation error about not compiling with SSL, rather than a runtime error, when a connection is established and TLS is apparently supposed to be used.
"Fixed" it by changing this
proc connect*(imap: ImapClient; host: string, port = imapPort) {.async} =
## Establish a connection to an IMAP server
await imap.sock.connect(host, port)
await imap.checkOk()
to this
proc connect*(imap: ImapClient; host: string, port = imapPort) {.async} =
## Establish a connection to an IMAP server
waitFor imap.sock.connect(host, port)
waitFor imap.checkOk()