v0.2.51..v0.2.52 changeset HootNetworkRequest.cpp
Garret Voltz edited this page Jan 15, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.cpp b/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.cpp
index caaf59d..ba204f8 100644
--- a/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.cpp
+++ b/hoot-core/src/main/cpp/hoot/core/io/HootNetworkRequest.cpp
@@ -35,6 +35,7 @@
// Qt
#include <QEventLoop>
+#include <QHostAddress>
#include <QtNetwork/QSslConfiguration>
#include <QtNetwork/QSslSocket>
@@ -167,6 +168,8 @@ bool HootNetworkRequest::_networkRequest(const QUrl& url,
// Remove authentication information if present
if (request.url() != tempUrl)
_error.replace(request.url().toString(), tempUrl.toString(QUrl::RemoveUserInfo), Qt::CaseInsensitive);
+ // Replace the IP address in the error string with <host-ip>
+ HootNetworkRequest::removeIpFromUrlString(_error, request.url());
return false;
}
@@ -216,4 +219,11 @@ void HootNetworkRequest::_setOAuthHeader(QNetworkAccessManager::Operation http_o
request.setRawHeader("Authorization", QString(header.c_str()).toUtf8());
}
+void HootNetworkRequest::removeIpFromUrlString(QString& endpointUrl, const QUrl& url)
+{
+ QHostAddress host(url.host());
+ if (!host.isNull())
+ endpointUrl.replace(url.host(), "<host-ip>");
+}
+
}