summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocket.cpp
diff options
context:
space:
mode:
authorMÃ¥rten Nordheim <marten.nordheim@qt.io>2022-12-12 15:25:20 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2022-12-21 15:30:54 +0100
commitda30f70fea239f723f1d36b076bb3f5860f50ed9 (patch)
treed3e7abdd6f860fcb5963a457655f00bef77ef65e /src/websockets/qwebsocket.cpp
parent482034a8f25f02662df0a2558b7f771f46cec142 (diff)
downloadqtwebsockets-da30f70fea239f723f1d36b076bb3f5860f50ed9.tar.gz
Support 401 response for websocket connections
Adds the authenticationRequired signal. [ChangeLog][QWebSocket] QWebSocket now supports 401 Unauthorized. Connect to the authenticationRequired signal to handle authentication challenges, or pass your credentials along with the URL. Fixes: QTBUG-92858 Change-Id: Ic43d1c12529dea278b2951e6f991cc1004fc3713 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/websockets/qwebsocket.cpp')
-rw-r--r--src/websockets/qwebsocket.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp
index 93d07f4..b495ffd 100644
--- a/src/websockets/qwebsocket.cpp
+++ b/src/websockets/qwebsocket.cpp
@@ -98,6 +98,27 @@ not been filled in with new information when the signal returns.
\sa QAuthenticator, QNetworkProxy
*/
+
+/*!
+ \fn void QWebSocket::authenticationRequired(QAuthenticator *authenticator)
+ \since 6.6
+
+ This signal is emitted when the server requires authentication.
+ The \a authenticator object must then be filled in with the required details
+ to allow authentication and continue the connection.
+
+ If you know that the server may require authentication, you can set the
+ username and password on the initial QUrl, using QUrl::setUserName and
+ QUrl::setPassword. QWebSocket will still try to connect \e{once} without
+ using the provided credentials.
+
+ \note It is not possible to use a QueuedConnection to connect to
+ this signal, as the connection will fail if the authenticator has
+ not been filled in with new information when the signal returns.
+
+ \sa QAuthenticator
+*/
+
/*!
\fn void QWebSocket::stateChanged(QAbstractSocket::SocketState state);