Export sslHandle in net and asyncnet. (#17573)

This commit is contained in:
Ardek Romak 2021-05-07 01:02:37 +03:00 • committed by GitHub
commit 9d86639a0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View file

@ -69,6 +69,8 @@
- Fixed buffer overflow bugs in `net`
- Exported `sslHandle` from `net` and `asyncnet`.
- Added `sections` iterator in `parsecfg`.
- Make custom op in macros.quote work for all statements.

View file

@ -736,6 +736,11 @@ proc close*(socket: AsyncSocket) =
raiseSSLError()
when defineSsl:
proc sslHandle*(self: AsyncSocket): SslPtr =
## Retrieve the ssl pointer of `socket`.
## Useful for interfacing with `openssl`.
self.sslHandle
proc wrapSocket*(ctx: SslContext, socket: AsyncSocket) =
## Wraps a socket in an SSL context. This function effectively turns
## `socket` into an SSL socket.

View file

@ -501,6 +501,11 @@ when defineSsl:
ERR_load_BIO_strings()
OpenSSL_add_all_algorithms()
proc sslHandle*(self: Socket): SslPtr =
## Retrieve the ssl pointer of `socket`.
## Useful for interfacing with `openssl`.
self.sslHandle
proc raiseSSLError*(s = "") =
## Raises a new SSL error.
if s != "":