QWebView displays "Network Access is disabled" and Qt Network Error 99
-
Running with:
-
Ubuntu 22.04.
-
Qt 5.12.8
-
OpenSSL 1.1.1f 31
QWebView is showing this error:
This Url works with no issues in the Firefox browser but QWebView seems to have an issue.
Here's the QNetworkReply info from the logs:
Failed URL: "https://dev-81029421.okta.com/app/dev-81029421_442710740samlidp_1/exkanm3x81DrxatKc5d7/sso/saml" NetworkError: QNetworkReply::UnknownNetworkError http status = 0 httpStatusMsg = ""
Here is my QWebView setup. I double checked everything and it looks correct. Not sure what to try next:
QWebView * m_samlView = new QWebView(); // Set User Agent QString browserUserAgent = m_samlView->page()->mainFrame()->evaluateJavaScript("navigator.userAgent").toString(); m_pUserAgentPage = new UserAgentWebPage(); m_pUserAgentPage->setBrowserUserAgent(browserUserAgent); m_samlView->setPage(m_pUserAgentPage); // Network Access Manager m_pNetworkAccessManager = new QNetworkAccessManager(); m_pNetworkAccessManager->setNetworkAccessible(QNetworkAccessManager::Accessible); m_samlView->page()->setNetworkAccessManager(m_pNetworkAccessManager); // Network Proxy checkProxy(); QNetworkProxy::setApplicationProxy(m_networkProxy); m_samlView->page()->networkAccessManager()->setProxy(m_networkProxy); // Enable Javascript m_samlView->page()->settings()->setAttribute(QWebSettings::JavascriptEnabled, true); // Enable web inspector m_samlView->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); QWebInspector inspector; inspector.setPage(m_samlView->page()); inspector.setVisible(true); // Setup Network Cookie Jar m_pCookieJar = new CookieJar(); m_samlView->page()->networkAccessManager()->setCookieJar(m_pCookieJar); // Clear cache and cookies clearCacheAndCookies(); // QWebView: Connect signals/slots connect(m_samlView, SIGNAL(urlChanged(const QUrl&)), this, SLOT(onUrlChanged(const QUrl&))); connect(m_samlView, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); // QNetworkAccessManager: Connect signals/slots connect(m_pNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); connect(m_pNetworkAccessManager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError>&)));
The web page in question is an Okta SAML Authentication page coming from a Gateway that is behind an Network Load Balancer. Not sure if this is affects the QNetworkReply error.
-
-
-
@SGaist Thank you for replying.
Currently the only QNAM signals connected are as follows:
// QNetworkAccessManager: Connect signals/slots connect(m_pNetworkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onFinished(QNetworkReply*))); connect(m_pNetworkAccessManager, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError>&)));
In this particular test case, we did not have proxy setup but you are right it may be a good idea to connect the QNAM auth signals in case we do. Which signals were you thinking of? Do you think that contributed to the crash?