313 void setSslErrorHandler( std::unique_ptr< QgsSslErrorHandler > handler );
331 void setAuthHandler( std::unique_ptr< QgsNetworkAuthenticationHandler > handler );
342 void insertProxyFactory( QNetworkProxyFactory *factory
SIP_TRANSFER );
358 const QList<QNetworkProxyFactory *> proxyFactories()
const;
368 const QNetworkProxy &fallbackProxy()
const;
379 QStringList excludeList()
const;
390 QStringList noProxyList()
const;
403 void setFallbackProxyAndExcludes(
const QNetworkProxy &proxy,
const QStringList &excludes,
const QStringList &noProxyURLs );
410 static QString cacheLoadControlName( QNetworkRequest::CacheLoadControl control );
417 static QNetworkRequest::CacheLoadControl cacheLoadControlFromName(
const QString &name );
426 void setupDefaultProxyAndCache( Qt::ConnectionType connectionType = Qt::BlockingQueuedConnection );
463 static int timeout();
472 static void setTimeout(
int time );
494 static QgsNetworkReplyContent blockingGet( QNetworkRequest &request,
const QString &authCfg = QString(),
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
516 static QgsNetworkReplyContent blockingPost( QNetworkRequest &request,
const QByteArray &data,
const QString &authCfg = QString(),
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
530 static QString setRequestPreprocessor(
const std::function<
void( QNetworkRequest *request )> &processor );
532 static QString setRequestPreprocessor( SIP_PYCALLABLE / AllowNone / );
537 Py_BEGIN_ALLOW_THREADS
542 PyObject *s = sipCallMethod( NULL, a0,
"D", arg, sipType_QNetworkRequest, NULL );
545 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
546 if ( sipIsError == 0 )
548 res = QString( *t1 );
550 sipReleaseType( t1, sipType_QString, state );
556 s = sipConvertFromNewType(
new QString(
id ), sipType_QString, 0 );
572 static bool removeRequestPreprocessor(
const QString &
id );
574 static void removeRequestPreprocessor(
const QString &
id );
578 PyErr_SetString( PyExc_KeyError, QStringLiteral(
"No processor with id %1 exists." ).arg( *a0 ).toUtf8().constData() );
596 static QString setReplyPreprocessor(
const std::function<
void (
const QNetworkRequest &, QNetworkReply * )> &processor );
598 static QString setReplyPreprocessor( SIP_PYCALLABLE / AllowNone / );
603 Py_BEGIN_ALLOW_THREADS
607 Py_XDECREF( sipCallMethod( NULL, a0,
"ND",
new QNetworkRequest( request ), sipType_QNetworkRequest, NULL, reply, sipType_QNetworkReply, NULL ) );
612 s = sipConvertFromNewType(
new QString(
id ), sipType_QString, 0 );
628 static bool removeReplyPreprocessor(
const QString &
id );
630 static void removeReplyPreprocessor(
const QString &
id );
634 PyErr_SetString( PyExc_KeyError, QStringLiteral(
"No processor with id %1 exists." ).arg( *a0 ).toUtf8().constData() );
646 void requestAuthOpenBrowser(
const QUrl &url )
const;
654 void requestAuthCloseBrowser()
const;
662 void abortAuthBrowser();
675 void preprocessRequest( QNetworkRequest *req )
const;
797 void sslErrorsOccurred( QNetworkReply *,
const QList<QSslError> &errors );
798 void sslErrorsHandled( QNetworkReply *reply );
814 void authRequestOccurred( QNetworkReply *, QAuthenticator *auth );
815 void authRequestHandled( QNetworkReply *reply );
836 void onReplyFinished( QNetworkReply *reply );
838 void onReplyDownloadProgress( qint64 bytesReceived, qint64 bytesTotal );
840 void onReplySslErrors(
const QList<QSslError> &errors );
842 void handleSslErrors( QNetworkReply *reply,
const QList<QSslError> &errors );
845 void onAuthRequired( QNetworkReply *reply, QAuthenticator *auth );
846 void handleAuthRequest( QNetworkReply *reply, QAuthenticator *auth );
848 void syncCookies(
const QList<QNetworkCookie> &cookies );
851 QNetworkReply *createRequest( QNetworkAccessManager::Operation op,
const QNetworkRequest &req, QIODevice *outgoingData =
nullptr )
override;
855 void afterSslErrorHandled( QNetworkReply *reply );
858 void afterAuthRequestHandled( QNetworkReply *reply );
860 void pauseTimeout( QNetworkReply *reply );
861 void restartTimeout( QNetworkReply *reply );
862 static int getRequestId( QNetworkReply *reply );
864 QList<QNetworkProxyFactory *> mProxyFactories;
865 QNetworkProxy mFallbackProxy;
866 QStringList mExcludedURLs;
867 QStringList mNoProxyURLs;
868 bool mUseSystemProxy =
false;
869 bool mInitialized =
false;
870 bool mCacheDisabled =
false;
873 std::unique_ptr< QgsSslErrorHandler > mSslErrorHandler;
875 QSemaphore mSslErrorHandlerSemaphore;
878 std::unique_ptr< QgsNetworkAuthenticationHandler > mAuthHandler;
880 QSemaphore mAuthRequestHandlerSemaphore;
882 friend class TestQgsNetworkAccessManager;
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...