15#ifndef QGSBLOCKINGNETWORKREQUEST_H
16#define QGSBLOCKINGNETWORKREQUEST_H
70 EmptyResponseIsValid = 1 << 0,
90 Qgis::NetworkRequestFlags
flags()
const {
return mFlags; }
137 ErrorCode post( QNetworkRequest &request, QIODevice *data,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
144 ErrorCode post( QNetworkRequest &request,
const QByteArray &data,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
166 ErrorCode head( QNetworkRequest &request,
bool forceRefresh =
false,
QgsFeedback *feedback =
nullptr );
185 ErrorCode put( QNetworkRequest &request, QIODevice *data,
QgsFeedback *feedback =
nullptr );
193 ErrorCode put( QNetworkRequest &request,
const QByteArray &data,
QgsFeedback *feedback =
nullptr );
212 ErrorCode deleteResource( QNetworkRequest &request,
QgsFeedback *feedback =
nullptr );
228 QString authCfg()
const;
234 void setAuthCfg(
const QString &authCfg );
268 void replyProgress( qint64, qint64 );
269 void replyFinished();
270 void requestTimedOut( QNetworkReply *
reply );
274 Qgis::NetworkRequestFlags mFlags;
277 QNetworkReply *mReply =
nullptr;
279 Qgis::HttpMethod mMethod =
Qgis::HttpMethod::Get;
282 QIODevice *mPayloadData =
nullptr;
288 QString mErrorMessage;
296 bool mIsAborted = false;
299 bool mForceRefresh = false;
302 bool mTimedout = false;
305 bool mGotNonEmptyResponse = false;
310 int mExpirationSec = 30;
316 QString errorMessageFailedAuth();
318 void sendRequestToNetworkAccessManager( const QNetworkRequest &request );
320 void abortIfNotPartialContentReturned();
326class DownloaderThread :
public QThread
331 DownloaderThread(
const std::function<
void()> &function, QObject *parent =
nullptr )
333 , mFunction( function )
343 std::function<void()> mFunction;
Provides global constants and enumerations for use throughout the application.
QgsBlockingNetworkRequest(Qgis::NetworkRequestFlags flags=Qgis::NetworkRequestFlags())
Constructor for QgsBlockingNetworkRequest.
void uploadProgress(qint64 bytesReceived, qint64 bytesTotal)
Emitted when when data are sent during a request.
Qgis::NetworkRequestFlags flags() const
Returns the network request flags.
Q_DECL_DEPRECATED void downloadFinished()
Emitted once a request has finished downloading.
void finished()
Emitted once a request has finished.
QString errorMessage() const
Returns the error message string, after a get(), post(), head() or put() request has been made.
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
Emitted when when data arrives during a request.
RequestFlag
Request flags.
QFlags< RequestFlag > RequestFlags
@ NetworkError
A network error occurred.
@ ServerExceptionError
An exception was raised by the server.
@ NoError
No error was encountered.
@ TimeoutError
Timeout was reached before a reply was received.
QgsNetworkReplyContent reply() const
Returns the content of the network reply, after a get(), post(), head() or put() request has been mad...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...
#define SIP_ENUM_BASETYPE(type)