aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-11-29 16:03:18 +0100
committerfiaxh <git@lightrise.org>2019-11-29 16:03:18 +0100
commitd194eae61d4fda8504a037daa721d9810ed1fe3e (patch)
tree0bca1c934573e7ee1d2528a8355f9297f7cb1f56 /xmpp-vala
parent1985fe1d7b94bd1eff80bb3da14bbc52e5585163 (diff)
downloaddino-d194eae61d4fda8504a037daa721d9810ed1fe3e.tar.gz
dino-d194eae61d4fda8504a037daa721d9810ed1fe3e.zip
Set ALPN info on XMPP connections if GIO >= 2.60
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/CMakeLists.txt12
-rw-r--r--xmpp-vala/src/module/xep/0368_srv_records_tls.vala3
2 files changed, 15 insertions, 0 deletions
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt
index 5836f96f..57347282 100644
--- a/xmpp-vala/CMakeLists.txt
+++ b/xmpp-vala/CMakeLists.txt
@@ -6,6 +6,16 @@ find_packages(ENGINE_PACKAGES REQUIRED
GObject
)
+set(ENGINE_DEFINITIONS "")
+
+find_package(GIO)
+if(GIO_VERSION VERSION_GREATER "2.60")
+ message(STATUS "ALPN support enabled")
+ set(ENGINE_DEFINITIONS ALPN_SUPPORT)
+else()
+ message(STATUS "No ALPN support, needs GIO >= 2.60")
+endif()
+
vala_precompile(ENGINE_VALA_C
SOURCES
"src/glib_fixes.vapi"
@@ -91,6 +101,8 @@ GENERATE_VAPI
xmpp-vala
GENERATE_HEADER
xmpp-vala
+DEFINITIONS
+ ${ENGINE_DEFINITIONS}
)
add_custom_target(xmpp-vala-vapi
diff --git a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala
index 3d0708fb..5a2a4559 100644
--- a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala
+++ b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala
@@ -39,6 +39,9 @@ public class TlsConnectionProvider : ConnectionProvider {
debug("Connecting to %s %i (tls)", srv_target.get_hostname(), srv_target.get_port());
IOStream? io_stream = yield client.connect_to_host_async(srv_target.get_hostname(), srv_target.get_port());
TlsConnection tls_connection = TlsClientConnection.new(io_stream, new NetworkAddress(stream.remote_name.to_string(), srv_target.get_port()));
+#if ALPN_SUPPORT
+ tls_connection.set_advertised_protocols(new string[]{"xmpp-client"});
+#endif
tls_connection.accept_certificate.connect(stream.get_module(Tls.Module.IDENTITY).on_invalid_certificate);
stream.add_flag(new Tls.Flag() { finished=true });
return tls_connection;