Skip to content

Commit bebda50

Browse files
committed
Support older versions of OpenSSL that don't supply SSL_CTX_clear_options.
1 parent 1b5b525 commit bebda50

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

asio/include/asio/ssl/impl/context.ipp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,19 +235,27 @@ void context::clear_options(context::options o)
235235
asio::error_code context::clear_options(
236236
context::options o, asio::error_code& ec)
237237
{
238-
#if !defined(SSL_OP_NO_COMPRESSION)
238+
#if (OPENSSL_VERSION_NUMBER >= 0x009080DFL) \
239+
&& (OPENSSL_VERSION_NUMBER != 0x00909000L)
240+
# if !defined(SSL_OP_NO_COMPRESSION)
239241
if ((o & context::no_compression) != 0)
240242
{
241-
#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
243+
# if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
242244
handle_->comp_methods = SSL_COMP_get_compression_methods();
243-
#endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
245+
# endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
244246
o ^= context::no_compression;
245247
}
246-
#endif // !defined(SSL_OP_NO_COMPRESSION)
248+
# endif // !defined(SSL_OP_NO_COMPRESSION)
247249

248250
::SSL_CTX_clear_options(handle_, o);
249251

250252
ec = asio::error_code();
253+
#else // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
254+
// && (OPENSSL_VERSION_NUMBER != 0x00909000L)
255+
(void)o;
256+
ec = asio::error::operation_not_supported;
257+
#endif // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
258+
// && (OPENSSL_VERSION_NUMBER != 0x00909000L)
251259
return ec;
252260
}
253261

0 commit comments

Comments
 (0)