summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/websockets/qwebsocket.cpp')
-rw-r--r--src/websockets/qwebsocket.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/websockets/qwebsocket.cpp b/src/websockets/qwebsocket.cpp
index a77f23c..3635003 100644
--- a/src/websockets/qwebsocket.cpp
+++ b/src/websockets/qwebsocket.cpp
@@ -389,7 +389,22 @@ void QWebSocket::close(QWebSocketProtocol::CloseCode closeCode, const QString &r
void QWebSocket::open(const QUrl &url)
{
Q_D(QWebSocket);
- d->open(url, true);
+ QNetworkRequest request(url);
+ d->open(request, true);
+}
+
+/*!
+ \brief Opens a WebSocket connection using the given \a request.
+ \since 5.6
+
+ The \a request url will be used to open the WebSocket connection.
+ Headers present in the request will be sent to the server in the upgrade request,
+ together with the ones needed for the websocket handshake.
+ */
+void QWebSocket::open(const QNetworkRequest &request)
+{
+ Q_D(QWebSocket);
+ d->open(request, true);
}
/*!
@@ -512,7 +527,17 @@ QString QWebSocket::resourceName() const
QUrl QWebSocket::requestUrl() const
{
Q_D(const QWebSocket);
- return d->requestUrl();
+ return d->request().url();
+}
+
+/*!
+ \brief Returns the request that was or will be used to open this socket.
+ \since 5.6
+ */
+QNetworkRequest QWebSocket::request() const
+{
+ Q_D(const QWebSocket);
+ return d->request();
}
/*!