Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2cc6011

Browse files
committed
Merge pull request libgit2#2684 from jacquesg/openssl-windows
Make the Visual Studio compiler happy
2 parents ea8dedc + bc48bcd commit 2cc6011

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/global.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ static void shutdown_ssl(void)
7373
static void init_ssl(void)
7474
{
7575
#ifdef GIT_SSL
76+
long ssl_opts = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
77+
78+
/* Older OpenSSL and MacOS OpenSSL doesn't have this */
79+
#ifdef SSL_OP_NO_COMPRESSION
80+
ssl_opts |= SSL_OP_NO_COMPRESSION;
81+
#endif
82+
7683
SSL_load_error_strings();
7784
OpenSSL_add_ssl_algorithms();
7885
/*
@@ -82,13 +89,7 @@ static void init_ssl(void)
8289
* to speak TLSv1 to perform the encryption itself.
8390
*/
8491
git__ssl_ctx = SSL_CTX_new(SSLv23_method());
85-
SSL_CTX_set_options(git__ssl_ctx,
86-
SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3
87-
/* Older OpenSSL and MacOS OpenSSL doesn't have this */
88-
# ifdef SSL_OP_NO_COMPRESSION
89-
| SSL_OP_NO_COMPRESSION
90-
# endif
91-
);
92+
SSL_CTX_set_options(git__ssl_ctx, ssl_opts);
9293
SSL_CTX_set_mode(git__ssl_ctx, SSL_MODE_AUTO_RETRY);
9394
SSL_CTX_set_verify(git__ssl_ctx, SSL_VERIFY_NONE, NULL);
9495
if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx)) {

0 commit comments

Comments
 (0)