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
git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1775257 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/SConstruct b/SConstruct
index 365112e..967802a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -426,6 +426,8 @@
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
diff --git a/buckets/ssl_buckets.c b/buckets/ssl_buckets.c
index b8eb5c5..be313d5 100644
--- a/buckets/ssl_buckets.c
+++ b/buckets/ssl_buckets.c
@@ -1864,7 +1864,7 @@
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 @@
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;