v0.2.53..v0.2.54 changeset HootNetworkRequest.h
Garret Voltz edited this page Mar 31, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.h b/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.h
index 4a4974a..ca79cc7 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.h
+++ b/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.h
@@ -22,7 +22,7 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#ifndef HOOT_NETWORK_REQUEST_H
@@ -69,23 +69,25 @@ public:
* @param url URL for the request
* @param http_op HTTP operation (GET, POST, or PUT), GET is default
* @param data POST data as a QByteArray
+ * @param timeout Timeout in seconds to block waiting for the reply, default to 5 minutes
* @return success
*/
bool networkRequest(const QUrl& url,
QNetworkAccessManager::Operation http_op = QNetworkAccessManager::Operation::GetOperation,
- const QByteArray& data = QByteArray());
+ const QByteArray& data = QByteArray(), int timeout = 300);
/**
* @brief networkRequest Function to make the actual request
* @param url URL for the request
* @param headers collection of known headers to set on the request
* @param http_op HTTP operation (GET, POST, or PUT), GET is default
* @param data POST data as a QByteArray
+ * @param timeout Timeout in seconds to block waiting for the reply, default to 5 minutes
* @return success
*/
bool networkRequest(const QUrl& url,
const QMap<QNetworkRequest::KnownHeaders, QVariant>& headers,
QNetworkAccessManager::Operation http_op = QNetworkAccessManager::Operation::GetOperation,
- const QByteArray& data = QByteArray());
+ const QByteArray& data = QByteArray(), int timeout = 300);
/**
* @brief getResponseContent
* @return HTTP response content
@@ -138,19 +140,21 @@ private:
* @param headers collection of known headers to set on the request
* @param http_op HTTP operation (GET, POST, or PUT), GET is default
* @param data POST data as a QByteArray
+ * @param timeout Timeout in seconds to block waiting for the reply
* @return success
*/
bool _networkRequest(const QUrl& url, const QMap<QNetworkRequest::KnownHeaders, QVariant>& headers,
- QNetworkAccessManager::Operation http_op, const QByteArray& data);
+ QNetworkAccessManager::Operation http_op, const QByteArray& data, int timeout);
/**
* @brief _blockOnReply Function to turn Qt asynchronous networking calls to synchronous
* @param reply Pointer to the network reply object to wait on
+ * @param timeout Timeout in seconds to block waiting for the reply
*/
- void _blockOnReply(QNetworkReply* reply);
+ void _blockOnReply(QNetworkReply* reply, int timeout);
/**
* @brief _getHttpResponseCode Get the HTTP response code from the response object
* @param reply Network reply object
- * @return HTTP response code as a number, 200 instead of "200"
+ * @return HTTP response code as an integer instead of a string
*/
int _getHttpResponseCode(QNetworkReply* reply);
/**