aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-01-13 16:43:12 +0100
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-01-13 18:35:25 +0100
commit767ee2e3a1082468b4e2248bac3ef8bd54bb2ddb (patch)
tree4de4178f16f8f339d36adb36b4ca82c270f6b7d5 /src/httpserver.cpp
parent31db3dd874dfbba88616c96a5767e2c9861d9a7a (diff)
parentc62d763fc313585d79ad833c9d729f6acf2652aa (diff)
downloadbitcoin-767ee2e3a1082468b4e2248bac3ef8bd54bb2ddb.tar.xz
Merge bitcoin/bitcoin#23607: rpc: Pass const char* to evhttp_connection_get_peer for new libevent
c62d763fc313585d79ad833c9d729f6acf2652aa Necessary improvements to make configure work without libevent installed (Perlover) 091ccc38c2e589b649648cbcc99aca4802f98775 The evhttp_connection_get_peer function from libevent changes the type of the second parameter. Fixing the problem. (Perlover) Pull request description: The second parameter of evhttp_connection_get_peer in libevent already has type as `const char **` The compilation of bitcoind with the fresh libevent occurs errors Details: https://github.com/bitcoin/bitcoin/issues/23606 ACKs for top commit: laanwj: Code review ACK c62d763fc313585d79ad833c9d729f6acf2652aa luke-jr: tACK c62d763fc313585d79ad833c9d729f6acf2652aa Tree-SHA512: d1c8062d90bd0d55c582dae2c3a7e5ee1b6c7ca872bf4aa7fe6f45a52ac4a8f59464215759d961f8efde0efbeeade31b08daf9387d7d50d7622baa1c06992d83
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 03328ac42c..e00c68585e 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -2,6 +2,10 @@
// 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;