diff options
author | Ardek Romak <ardek66@tutanota.com> | 2021-05-07 01:02:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-06 15:02:37 -0700 |
commit | 9d86639a0b65acdc7842ef66ad8d2f97a992e4b8 (patch) | |
tree | 9021f425ac017aa3a92277514fdd5152f8f6fd88 | |
parent | 9b126de65cdb6c8b59e0eb58763ca2878f456e0d (diff) | |
download | Nim-9d86639a0b65acdc7842ef66ad8d2f97a992e4b8.tar.gz |
Export sslHandle in `net` and `asyncnet`. (#17573)
-rw-r--r-- | changelog.md | 2 | ||||
-rw-r--r-- | lib/pure/asyncnet.nim | 5 | ||||
-rw-r--r-- | lib/pure/net.nim | 5 |
3 files changed, 12 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index 0c95295cd..d1e04177d 100644 --- a/changelog.md +++ b/changelog.md @@ -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. diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 7ef40a128..5523fa10e 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -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. diff --git a/lib/pure/net.nim b/lib/pure/net.nim index 343cdc9b1..ff179fb2c 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -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 != "": |