Skip to content

Commit

Permalink
Simplify SSL_set_mode() calls (#7444)
Browse files Browse the repository at this point in the history
SSL_set_mode() adds the mode set via bitmask in mode to ssl.
  • Loading branch information
twose authored Sep 1, 2021
1 parent a13730c commit aa893c4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions ext/openssl/xp_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ int php_openssl_setup_crypto(php_stream *stream,
}

#ifdef SSL_MODE_RELEASE_BUFFERS
SSL_set_mode(sslsock->ssl_handle, SSL_get_mode(sslsock->ssl_handle) | SSL_MODE_RELEASE_BUFFERS);
SSL_set_mode(sslsock->ssl_handle, SSL_MODE_RELEASE_BUFFERS);
#endif

if (cparam->inputs.session) {
Expand Down Expand Up @@ -1861,14 +1861,7 @@ static int php_openssl_enable_crypto(php_stream *stream,
sslsock->s.is_blocked = 0;
/* The following mode are added only if we are able to change socket
* to non blocking mode which is also used for read and write */
SSL_set_mode(
sslsock->ssl_handle,
(
SSL_get_mode(sslsock->ssl_handle) |
SSL_MODE_ENABLE_PARTIAL_WRITE |
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER
)
);
SSL_set_mode(sslsock->ssl_handle, SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
}

timeout = sslsock->is_client ? &sslsock->connect_timeout : &sslsock->s.timeout;
Expand Down

0 comments on commit aa893c4

Please sign in to comment.