QNetworkReply* QtNetworkAccessManager::createRequest(Operation operation, const QNetworkRequest& request, QIODevice* outData) { WebPage* webPage = obtainOriginatingWebPage(request); if (webPage && m_applicationSchemes.contains(webPage, request.url().scheme().toLower())) { QtNetworkReply* reply = new QtNetworkReply(request, this); webPage->receivedApplicationSchemeRequest(request, reply); return reply; } return QNetworkAccessManager::createRequest(operation, request, outData); }
void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslError>& qSslErrors) { #ifndef QT_NO_SSL WebPage* webPage = obtainOriginatingWebPage(reply->request()); // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512. if (!webPage) return; String hostname = reply->url().host(); bool ignoreErrors = false; if (webPage->sendSync( Messages::WebPageProxy::CertificateVerificationRequest(hostname), Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) { if (ignoreErrors) reply->ignoreSslErrors(qSslErrors); } #endif }
void QtNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) { WebPage* webPage = obtainOriginatingWebPage(reply->request()); // FIXME: This check can go away once our Qt version is up-to-date. See: QTBUG-23512. if (!webPage) return; String hostname = reply->url().toString(QUrl::RemovePath | QUrl::RemoveQuery | QUrl::RemoveFragment | QUrl::StripTrailingSlash); String realm = authenticator->realm(); String prefilledUsername = authenticator->user(); String username; String password; if (webPage->sendSync( Messages::WebPageProxy::AuthenticationRequiredRequest(hostname, realm, prefilledUsername), Messages::WebPageProxy::AuthenticationRequiredRequest::Reply(username, password))) { if (!username.isEmpty()) authenticator->setUser(username); if (!password.isEmpty()) authenticator->setPassword(password); } }