mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
add request attribute
add followredirect and prefercache
This commit is contained in:
parent
9779b1d723
commit
b242a5b89c
|
@ -9,6 +9,7 @@ void ResourceSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob)
|
||||||
|
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
request.setUrl(url);
|
request.setUrl(url);
|
||||||
|
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
|
||||||
QNetworkReply *reply = this->mManager.createRequest(QNetworkAccessManager::GetOperation, request);
|
QNetworkReply *reply = this->mManager.createRequest(QNetworkAccessManager::GetOperation, request);
|
||||||
connect(reply, &QNetworkReply::finished, requestJob, [=]() {
|
connect(reply, &QNetworkReply::finished, requestJob, [=]() {
|
||||||
if (reply->error() == QNetworkReply::ContentNotFoundError) {
|
if (reply->error() == QNetworkReply::ContentNotFoundError) {
|
||||||
|
|
|
@ -125,7 +125,9 @@ WebSiteArticleRequest::WebSiteArticleRequest( QString const & url_,
|
||||||
|
|
||||||
QUrl reqUrl( url );
|
QUrl reqUrl( url );
|
||||||
|
|
||||||
netReply = mgr.get( QNetworkRequest( reqUrl ) );
|
auto request = QNetworkRequest( reqUrl );
|
||||||
|
request.setAttribute( QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy );
|
||||||
|
netReply = mgr.get( request );
|
||||||
|
|
||||||
#ifndef QT_NO_OPENSSL
|
#ifndef QT_NO_OPENSSL
|
||||||
connect( netReply, SIGNAL( sslErrors( QList< QSslError > ) ),
|
connect( netReply, SIGNAL( sslErrors( QList< QSslError > ) ),
|
||||||
|
|
Loading…
Reference in a new issue