315 void setSslErrorHandler( std::unique_ptr< QgsSslErrorHandler > handler );
333 void setAuthHandler( std::unique_ptr< QgsNetworkAuthenticationHandler > handler );
344 void insertProxyFactory( QNetworkProxyFactory *factory
SIP_TRANSFER );
360 const QList<QNetworkProxyFactory *> proxyFactories()
const;
370 const QNetworkProxy &fallbackProxy()
const;
381 QStringList excludeList()
const;
392 QStringList noProxyList()
const;
405 void setFallbackProxyAndExcludes(
const QNetworkProxy &proxy,
const QStringList &excludes,
const QStringList &noProxyURLs );
412 static QString cacheLoadControlName( QNetworkRequest::CacheLoadControl control );
419 static QNetworkRequest::CacheLoadControl cacheLoadControlFromName(
const QString &name );
428 void setupDefaultProxyAndCache( Qt::ConnectionType connectionType = Qt::BlockingQueuedConnection );
465 static int timeout();
474 static void setTimeout(
int time );
496 static QgsNetworkReplyContent blockingGet( QNetworkRequest &request,
const QString &authCfg = QString(),
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
518 static QgsNetworkReplyContent blockingPost( QNetworkRequest &request,
const QByteArray &data,
const QString &authCfg = QString(),
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
532 static QString setRequestPreprocessor(
const std::function<
void( QNetworkRequest *request )> &processor );
534 static QString setRequestPreprocessor( SIP_PYCALLABLE / AllowNone / );
537 Py_BEGIN_ALLOW_THREADS
543 PyObject *s = sipCallMethod( NULL, a0,
"D", arg, sipType_QNetworkRequest, NULL );
546 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
547 if ( sipIsError == 0 )
549 res = QString( *t1 );
551 sipReleaseType( t1, sipType_QString, state );
556 s = sipConvertFromNewType(
new QString(
id ), sipType_QString, 0 );
573 static bool removeRequestPreprocessor(
const QString &
id );
575 static void removeRequestPreprocessor(
const QString &
id );
579 PyErr_SetString( PyExc_KeyError, QStringLiteral(
"No processor with id %1 exists." ).arg( *a0 ).toUtf8().constData() );
597 static QString setReplyPreprocessor(
const std::function<
void (
const QNetworkRequest &, QNetworkReply * )> &processor );
599 static QString setReplyPreprocessor( SIP_PYCALLABLE / AllowNone / );
602 Py_BEGIN_ALLOW_THREADS
607 Py_XDECREF( sipCallMethod( NULL, a0,
"ND",
new QNetworkRequest( request ), sipType_QNetworkRequest, NULL, reply, sipType_QNetworkReply, NULL ) );
611 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;
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...