aboutsummaryrefslogtreecommitdiffstats
path: root/src/websockets/qwebsocket_p.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-08-22 13:13:22 +0200
committerOswald Buddenhagen <oswald.buddenhagen@gmx.de>2023-08-22 11:53:37 +0000
commitedd1df7dc6f5fa776b9b8be2003e0210821ceee0 (patch)
tree7c40a58e7debee485d182331d93ef83ff88be879 /src/websockets/qwebsocket_p.cpp
parentbbd15a22a360e078afef3213d83eb8076f3dde96 (diff)
Split error message about unsupported WWW-Authenticate challenges
Passing the count is wrong unless %n is actually used. Amends da30f70fea239f723f1d36b076bb3f5860f50ed9. Task-number: QTBUG-92858 Pick-to: 6.6 Change-Id: I3aed91dde4b8e9321b9408d02d50eb31a93439ba Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/websockets/qwebsocket_p.cpp')
-rw-r--r--src/websockets/qwebsocket_p.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 401e756..83455d9 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -967,6 +967,17 @@ qint64 QWebSocketPrivate::writeFrame(const QByteArray &frame)
return written;
}
+static QString msgUnsupportedAuthenticateChallenges(qsizetype count)
+{
+ // Keep the error on a single line so it can easily be searched for:
+ //: 'WWW-Authenticate' is the HTTP header.
+ return count == 1
+ ? QWebSocket::tr("QWebSocketPrivate::processHandshake: "
+ "Unsupported WWW-Authenticate challenge encountered.")
+ : QWebSocket::tr("QWebSocketPrivate::processHandshake: "
+ "Unsupported WWW-Authenticate challenges encountered.");
+}
+
//called on the client for a server handshake response
/*!
\internal
@@ -1103,11 +1114,7 @@ void QWebSocketPrivate::processHandshake(QTcpSocket *pSocket)
if (isSupported)
priv->parseHttpResponse(parser.headers(), /*isProxy=*/false, m_request.url().host());
if (!isSupported || priv->method == QAuthenticatorPrivate::None) {
- // Keep the error on a single line so it can easily be searched for:
- errorDescription = QWebSocket::tr(
- "QWebSocketPrivate::processHandshake: "
- "Unsupported WWW-Authenticate challenge(s) encountered.",
- "'WWW-Authenticate' is the HTTP header.", int(challenges.size()));
+ errorDescription = msgUnsupportedAuthenticateChallenges(challenges.size());
break;
}