You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by st...@apache.org on 2016/12/20 10:52:19 UTC

svn commit: r1775257 - in /serf/trunk: SConstruct buckets/ssl_buckets.c

Author: stsp
Date: Tue Dec 20 10:52:19 2016
New Revision: 1775257

URL: http://svn.apache.org/viewvc?rev=1775257&view=rev
Log:
Get rid of another SSL feature check based on a version number.

* SConstruct: Add a check for OpenSSL ALPN support and provide
   SERF_HAVE_OPENSSL_ALPN.

* buckets/ssl_buckets.c:
  (serf_ssl_negotiate_protocol, ssl_get_selected_protocol): Use
   SERF_HAVE_OPENSSL_ALPN instead of OPENSSL_VERSION_NUMBER.

Found by: brane

Modified:
    serf/trunk/SConstruct
    serf/trunk/buckets/ssl_buckets.c

Modified: serf/trunk/SConstruct
URL: http://svn.apache.org/viewvc/serf/trunk/SConstruct?rev=1775257&r1=1775256&r2=1775257&view=diff
==============================================================================
--- serf/trunk/SConstruct (original)
+++ serf/trunk/SConstruct Tue Dec 20 10:52:19 2016
@@ -426,6 +426,8 @@ if conf.CheckFunc('CRYPTO_set_locking_ca
   env.Append(CPPDEFINES=['SERF_HAVE_SSL_LOCKING_CALLBACKS'])
 if conf.CheckFunc('OPENSSL_malloc_init'):
   env.Append(CPPDEFINES=['SERF_HAVE_OPENSSL_MALLOC_INIT'])
+if conf.CheckFunc('SSL_set_alpn_protos'):
+  env.Append(CPPDEFINES=['SERF_HAVE_OPENSSL_ALPN'])
 env = conf.Finish()
 
 # If build with gssapi, get its information and define SERF_HAVE_GSSAPI

Modified: serf/trunk/buckets/ssl_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/buckets/ssl_buckets.c?rev=1775257&r1=1775256&r2=1775257&view=diff
==============================================================================
--- serf/trunk/buckets/ssl_buckets.c (original)
+++ serf/trunk/buckets/ssl_buckets.c Tue Dec 20 10:52:19 2016
@@ -1864,7 +1864,7 @@ apr_status_t serf_ssl_negotiate_protocol
     memcpy(at, protocols, len);
     at += len;
 
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L /* >= 1.0.2 */
+#ifdef SERF_HAVE_OPENSSL_ALPN
     if (SSL_set_alpn_protos(context->ssl, raw_header, raw_len)) {
         ERR_clear_error();
     }
@@ -1889,7 +1889,7 @@ apr_status_t serf_ssl_negotiate_protocol
 static const char *ssl_get_selected_protocol(serf_ssl_context_t *context)
 {
     if (! context->selected_protocol) {
-#if OPENSSL_VERSION_NUMBER >= 0x10002000L /* >= 1.0.2 */
+#ifdef SERF_HAVE_OPENSSL_ALPN
         const unsigned char *data = NULL;
         unsigned len = 0;
 



Re: svn commit: r1775257 - in /serf/trunk: SConstruct buckets/ssl_buckets.c

Posted by Branko Čibej <br...@apache.org>.
On 20.12.2016 11:52, stsp@apache.org wrote:
> Author: stsp
> Date: Tue Dec 20 10:52:19 2016
> New Revision: 1775257
>
> URL: http://svn.apache.org/viewvc?rev=1775257&view=rev
> Log:
> Get rid of another SSL feature check based on a version number.
>
> * SConstruct: Add a check for OpenSSL ALPN support and provide
>    SERF_HAVE_OPENSSL_ALPN.
>
> * buckets/ssl_buckets.c:
>   (serf_ssl_negotiate_protocol, ssl_get_selected_protocol): Use
>    SERF_HAVE_OPENSSL_ALPN instead of OPENSSL_VERSION_NUMBER.


AFAIK there are somewhat equivalent checks in the tests, too; worth a look?

-- Brane