aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 6e75e28596..e00c68585e 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -1,7 +1,11 @@
-// Copyright (c) 2015-2020 The Bitcoin Core developers
+// Copyright (c) 2015-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#if defined(HAVE_CONFIG_H)
+#include <config/bitcoin-config.h>
+#endif
+
#include <httpserver.h>
#include <chainparamsbase.h>
@@ -597,7 +601,13 @@ CService HTTPRequest::GetPeer() const
// evhttp retains ownership over returned address string
const char* address = "";
uint16_t port = 0;
+
+#ifdef HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
+ evhttp_connection_get_peer(con, &address, &port);
+#else
evhttp_connection_get_peer(con, (char**)&address, &port);
+#endif // HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR
+
peer = LookupNumeric(address, port);
}
return peer;