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 );
107 ErrorCode post( QNetworkRequest &request,
const QByteArray &data,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
123 QString authCfg()
const;
129 void setAuthCfg(
const QString &authCfg );
143 void downloadProgress( qint64, qint64 );
148 void downloadFinished();
151 void replyProgress( qint64, qint64 );
152 void replyFinished();
153 void requestTimedOut( QNetworkReply *reply );
164 QNetworkReply *mReply =
nullptr;
166 Method mMethod = Get;
167 QByteArray mPostData;
173 QString mErrorMessage;
181 bool mIsAborted =
false;
184 bool mForceRefresh =
false;
187 bool mTimedout =
false;
190 bool mGotNonEmptyResponse =
false;
192 int mExpirationSec = 30;
194 QPointer< QgsFeedback > mFeedback;
196 ErrorCode doRequest( Method method, QNetworkRequest &request,
bool forceRefresh,
QgsFeedback *feedback =
nullptr );
198 QString errorMessageFailedAuth();
205 class DownloaderThread :
public QThread
210 DownloaderThread(
const std::function<
void()> &
function, QObject *parent =
nullptr )
212 , mFunction(
function )
222 std::function<void()> mFunction;
228 #endif // QGSBLOCKINGNETWORKREQUEST_H
Timeout was reached before a reply was received.
Base class for feedback objects to be used for cancelation of something running in a worker thread...
A thread safe class for performing blocking (sync) network requests, with full support for QGIS proxy...
QString errorMessage() const
Returns the error message string, after a get() or post() request has been made.
QgsNetworkReplyContent reply() const
Returns the content of the network reply, after a get() or post() request has been made...
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...
A network error occurred.
No error was encountered.
An exception was raised by the server.