Skip to content

Commit

Permalink
Client: Set ALPN 'xmpp-client' protocol
Browse files Browse the repository at this point in the history
This is needed so that TLS protocol multiplexers work correctly and a
single port can be used for XMPP, HTTPS and possibly other protocols.
  • Loading branch information
lnjX committed Jul 29, 2024
1 parent 3285c01 commit b6239de
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/client/QXmppOutgoingClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,20 @@ QXmppOutgoingClientPrivate::QXmppOutgoingClientPrivate(QXmppOutgoingClient *qq)

void QXmppOutgoingClientPrivate::connectToHost(const ServerAddress &address)
{
QSslConfiguration sslConfig;

// override CA certificates if requested
if (!config.caCertificates().isEmpty()) {
QSslConfiguration newSslConfig;
newSslConfig.setCaCertificates(config.caCertificates());
q->socket()->setSslConfiguration(newSslConfig);
sslConfig.setCaCertificates(config.caCertificates());
}
// ALPN protocol 'xmpp-client'
sslConfig.setAllowedNextProtocols({ QByteArrayLiteral("xmpp-client") });

// set new ssl config
q->socket()->setSslConfiguration(sslConfig);

// respect proxy
q->socket()->setProxy(config.networkProxy());

// set the name the SSL certificate should match
q->socket()->setPeerVerifyName(config.domain());

Expand Down

0 comments on commit b6239de

Please sign in to comment.