Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.6.0
-
None
Description
Hi!
I am using QHttpServer for a Viber bot and yesterday stopped working because they changed something and from now on if you have a Let's Encrypt certificate for free than you have a chain in it and that is not working together with the new Viber setup. The current implementation in the QHttpServer the
void sslSetup(const QSslCertificate &certificate, ... );
function only supports one certificate to send to the Viber framework which leads to a TLS error "Alert (Level: Fatal, Description: Certificate unknown)" and the socket is closed. This happend only when you tried to send a message from a Phone/PC client to the bot. When the bot communicated with the Viber framework it worked fine.
I am proposing this simple fix to solve this problem:
Add to class QAbstractHttpServer in qabstracthttpserver.h : 48. :
#if QT_CONFIG(ssl) void sslSetup(const QSslCertificate &certificate, const QSslKey &privateKey, QSsl::SslProtocol protocol = QSsl::SecureProtocols); void sslSetup(const QList<QSslCertificate> &certificates, const QSslKey &privateKey, QSsl::SslProtocol protocol = QSsl::SecureProtocols); void sslSetup(const QSslConfiguration &sslConfiguration); #endif
add to the qabstracthttpserver.cpp : 260
void QAbstractHttpServer::sslSetup(const QList<QSslCertificate> &certificates, const QSslKey &privateKey, QSsl::SslProtocol protocol) { QSslConfiguration conf; conf.setLocalCertificateChain(certificates); conf.setPrivateKey(privateKey); conf.setProtocol(protocol); sslSetup(conf); }
With this small change the Viber bot started to work again.
Thank you!