diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/openssl/ossl_ssl.c | 7 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Wed Jun 22 15:01:24 2011 Martin Bosslet <Martin.Bosslet@googlemail.com> + + * ext/openssl/ossl_ssl.c: Use SSL_MODE_RELEASE_BUFFERS if available. + Thanks, Eric Wong, for providing the patch. + [ Ruby 1.9 - Feature #4672 ] [ruby-core:36127] + Wed Jun 22 14:47:53 2011 Martin Bosslet <Martin.Bosslet@googlemail.com> * test/openssl/test_buffering.rb diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 3122c0e4ea..bcfaa32182 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -140,12 +140,17 @@ static VALUE ossl_sslctx_s_alloc(VALUE klass) { SSL_CTX *ctx; + long mode = SSL_MODE_ENABLE_PARTIAL_WRITE; + +#ifdef SSL_MODE_RELEASE_BUFFERS + mode |= SSL_MODE_RELEASE_BUFFERS; +#endif ctx = SSL_CTX_new(SSLv23_method()); if (!ctx) { ossl_raise(eSSLError, "SSL_CTX_new:"); } - SSL_CTX_set_mode(ctx, SSL_MODE_ENABLE_PARTIAL_WRITE); + SSL_CTX_set_mode(ctx, mode); SSL_CTX_set_options(ctx, SSL_OP_ALL); return Data_Wrap_Struct(klass, 0, ossl_sslctx_free, ctx); } |