15 #ifndef QGSBLOCKINGNETWORKREQUEST_H
16 #define QGSBLOCKINGNETWORKREQUEST_H
18 #include "qgis_core.h"
26 class QNetworkRequest;
85 ErrorCode get( QNetworkRequest &request,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
108 ErrorCode post( QNetworkRequest &request, QIODevice *data,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
115 ErrorCode post( QNetworkRequest &request,
const QByteArray &data,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
137 ErrorCode head( QNetworkRequest &request,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
156 ErrorCode put( QNetworkRequest &request, QIODevice *data,
QgsFeedback *feedback =
nullptr );
164 ErrorCode put( QNetworkRequest &request,
const QByteArray &data,
QgsFeedback *feedback =
nullptr );
183 ErrorCode deleteResource( QNetworkRequest &request,
QgsFeedback *feedback =
nullptr );
199 QString authCfg()
const;
205 void setAuthCfg(
const QString &authCfg );
219 void downloadProgress( qint64, qint64 );
231 void uploadProgress( qint64, qint64 );
239 void replyProgress( qint64, qint64 );
240 void replyFinished();
241 void requestTimedOut( QNetworkReply *reply );
255 QNetworkReply *mReply =
nullptr;
257 Method mMethod = Get;
260 QIODevice *mPayloadData;
266 QString mErrorMessage;
269 ErrorCode mErrorCode = NoError;
274 bool mIsAborted =
false;
277 bool mForceRefresh =
false;
280 bool mTimedout =
false;
283 bool mGotNonEmptyResponse =
false;
285 int mExpirationSec = 30;
287 QPointer< QgsFeedback > mFeedback;
289 ErrorCode doRequest( Method method, QNetworkRequest &request,
bool forceRefresh,
QgsFeedback *feedback =
nullptr );
291 QString errorMessageFailedAuth();
293 void sendRequestToNetworkAccessManager(
const QNetworkRequest &request );
299 class DownloaderThread :
public QThread
304 DownloaderThread(
const std::function<
void()> &
function, QObject *parent =
nullptr )
306 , mFunction( function )
316 std::function<void()> mFunction;
322 #endif // QGSBLOCKINGNETWORKREQUEST_H