Skip to content

Commit ee044c1

Browse files
committed
Add SSL.close() and SSLClosed for orderly TLS shutdown
Pony's SSL wrapper had no way to send a TLS close_notify alert. Tearing down a connection without one causes the peer to report a protocol error instead of a clean closure, and some peers (notably Go's net/http) treat that as a request failure. SSL.close() calls SSL_shutdown to queue a close_notify in the output BIO. SSLClosed is a new state that means the TLS session ended cleanly — either the peer sent close_notify (detected by read) or the consumer called close. The write side shuts down but the read side stays open so the peer's remaining data and close_notify response can still arrive. SSL_ERROR_ZERO_RETURN from SSL_read and SSL_write now produces SSLClosed instead of SSLError, giving consumers a way to distinguish a clean peer closure from a protocol failure. SSLConnection handles the new state: _do_shutdown sends the response close_notify, flushes the encrypted bytes, and closes the TCP connection. Design: ponylang/lori#348
1 parent fc00e12 commit ee044c1

3 files changed

Lines changed: 555 additions & 14 deletions

File tree

0 commit comments

Comments
 (0)