-
Bug
-
Resolution: Done
-
P2: Important
-
5.13.2, 5.15.3
-
None
-
7b3570a962 (qt/qtwebengine/dev) b04bab528b (qt/qtwebengine/6.4) b04bab528b (qt/tqtc-qtwebengine/6.4)
Starting with QtWebEngine 5.13, an installed QWebEngineUrlRequestInterceptor will not be called for WebSocket connections anymore.
This can be reproduced by patching simplebrowser like so:
diff --git i/examples/webenginewidgets/simplebrowser/main.cpp w/examples/webenginewidgets/simplebrowser/main.cpp
index ddc8b4d0..c7c42616 100644
--- i/examples/webenginewidgets/simplebrowser/main.cpp
+++ w/examples/webenginewidgets/simplebrowser/main.cpp
@@ -54,6 +54,8 @@
#include <QApplication>
#include <QWebEngineProfile>
#include <QWebEngineSettings>
+#include <QWebEngineUrlRequestInterceptor>
+#include <QDebug>
QUrl commandLineUrlArgument()
{
@@ -65,6 +67,16 @@ QUrl commandLineUrlArgument()
return QUrl(QStringLiteral("https://www.qt.io"));
}
+class Interceptor : public QWebEngineUrlRequestInterceptor
+{
+ void interceptRequest(QWebEngineUrlRequestInfo&);
+};
+
+void Interceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
+{
+ qDebug() << info.requestUrl();
+}
+
int main(int argc, char **argv)
{
QCoreApplication::setOrganizationName("QtExamples");
@@ -79,6 +91,9 @@ int main(int argc, char **argv)
QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
QWebEngineProfile::defaultProfile()->setUseForGlobalCertificateVerification();
#endif
+ Interceptor interceptor{};
+ //QWebEngineProfile::defaultProfile()->setRequestInterceptor(&interceptor);
+ QWebEngineProfile::defaultProfile()->setUrlRequestInterceptor(&interceptor);
QUrl url = commandLineUrlArgument();
And then visiting https://libwebsockets.org/testserver/ - or alternatively, visit http://www.websocket.org/echo.html and click "Connect", though that website seems semi-down at the moment.
With Qt 5.12, QUrl("wss://libwebsockets.org/") is logged and setting custom headers on it works fine. With Qt 5.13+, even when using the deprecated setRequestInterceptor, the connection isn't intercepted at all.
- resulted in
-
QTBUG-117752 QWebEngineUrlRequestInterceptor not called on page, if the one set on the profile changed the info
-
- Closed
-