diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-12 18:00:32 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-12 18:00:32 +0000 |
| commit | d39777712d97180ff439461813083cbc7892a2a1 (patch) | |
| tree | 2c8d4e70773b2be86cb17f9070b6e1b9d90e0e35 | |
| parent | 745c7d9c8e60cb08b369c85ee9fee0ec684701b3 (diff) | |
| download | nginx-d39777712d97180ff439461813083cbc7892a2a1.tar.gz nginx-d39777712d97180ff439461813083cbc7892a2a1.tar.bz2 | |
Merge of r4868, r4869: SSL minor fixes.
*) SSL: fixed compression workaround to remove all methods.
Previous code used sk_SSL_COMP_delete(ssl_comp_methods, i) while iterating
stack from 0 to n, resulting in removal of only even compression methods.
In real life this change is a nop, as there is only one compression method
which is enabled by default in OpenSSL.
*) SSL: added version checks for ssl compression workaround.
The SSL_COMP_get_compression_methods() is only available as an API
function in OpenSSL 0.9.8+, require it explicitly to unbreak build
with OpenSSL 0.9.7.
| -rw-r--r-- | src/event/ngx_event_openssl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 4356a05ef..5e25b0156 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c @@ -94,23 +94,25 @@ ngx_ssl_init(ngx_log_t *log) OpenSSL_add_all_algorithms(); +#if OPENSSL_VERSION_NUMBER >= 0x0090800fL #ifndef SSL_OP_NO_COMPRESSION { /* * Disable gzip compression in OpenSSL prior to 1.0.0 version, * this saves about 522K per connection. */ - int i, n; + int n; STACK_OF(SSL_COMP) *ssl_comp_methods; ssl_comp_methods = SSL_COMP_get_compression_methods(); n = sk_SSL_COMP_num(ssl_comp_methods); - for (i = 0; i < n; i++) { - (void) sk_SSL_COMP_delete(ssl_comp_methods, i); + while (n--) { + (void) sk_SSL_COMP_pop(ssl_comp_methods); } } #endif +#endif ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL); |
