Skip to content

Commit

Permalink
Merge pull request #128 from jhawthorn/ssl-zero-return
Browse files Browse the repository at this point in the history
Report EOFError: TRILOGY_CLOSED_CONNECTION for SSL_ERROR_ZERO_RETURN
  • Loading branch information
jhawthorn authored Oct 21, 2023
2 parents 9f4a976 + 4eb7a82 commit 1d78d7b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ static ssize_t ssl_io_return(struct trilogy_sock *sock, ssize_t ret)
int rc = SSL_get_error(sock->ssl, (int)ret);
if (rc == SSL_ERROR_WANT_WRITE || rc == SSL_ERROR_WANT_READ) {
return (ssize_t)TRILOGY_AGAIN;
} else if (rc == SSL_ERROR_ZERO_RETURN) {
// Server has closed the connection for writing by sending the close_notify alert
return (ssize_t)TRILOGY_CLOSED_CONNECTION;
} else if (rc == SSL_ERROR_SYSCALL && !ERR_peek_error()) {
if (errno == 0) {
// On OpenSSL <= 1.1.1, SSL_ERROR_SYSCALL with an errno value
Expand Down

0 comments on commit 1d78d7b

Please sign in to comment.