aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-06-28 12:06:25 +0100
committerfanquake <fanquake@gmail.com>2023-06-28 12:20:25 +0100
commita15388c6061bcbf21cb9584db19ed34e79f7206d (patch)
treee307f29dd02038c5ce4cecda07ecf1adb27a26c6 /src/httpserver.cpp
parentec822e88dd691297dbd7f36848a4b9e792ef83df (diff)
parent79d343a642f985801da463b03a0627a59a095238 (diff)
Merge bitcoin/bitcoin#27949: http: update libevent workaround to correct version
79d343a642f985801da463b03a0627a59a095238 http: update libevent workaround to correct version (stickies-v) Pull request description: The libevent bug described in https://github.com/libevent/libevent/commit/5ff8eb26371c4dc56f384b2de35bea2d87814779 was already patched in [release-2.1.9-beta](https://github.com/libevent/libevent/releases/tag/release-2.1.9-beta), with cherry-picked commits [5b40744d1581447f5b4496ee8d4807383e468e7a](https://github.com/libevent/libevent/commit/5b40744d1581447f5b4496ee8d4807383e468e7a) and [b25813800f97179b2355a7b4b3557e6a7f568df2](https://github.com/libevent/libevent/commit/b25813800f97179b2355a7b4b3557e6a7f568df2). There should be no side-effects by re-applying the workaround on an already patched version of libevent (as is currently done in master for people running libevent between 2.1.9 and 2.1.12), but it is best to just set the correct version number to avoid confusion. This will prevent situations like e.g. in https://github.com/bitcoin/bitcoin/pull/27909#discussion_r1238858604, where a reverse workaround was incorrectly applied to the wrong version range. ACKs for top commit: fanquake: ACK 79d343a642f985801da463b03a0627a59a095238 Tree-SHA512: 56d2576411cf38e56d0976523fec951e032a48e35af293ed1ef3af820af940b26f779b9197baaed6d8b79bd1c7f7334646b9d73f80610d63cffbc955958ca8a0
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 42f4ec5833..a83f4421d7 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -221,8 +221,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
}, nullptr);
}
- // Disable reading to work around a libevent bug, fixed in 2.2.0.
- if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
+ // Disable reading to work around a libevent bug, fixed in 2.1.9
+ // See https://github.com/libevent/libevent/commit/5ff8eb26371c4dc56f384b2de35bea2d87814779
+ // and https://github.com/bitcoin/bitcoin/pull/11593.
+ if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
evhttp_connection* conn = evhttp_request_get_connection(req);
if (conn) {
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
@@ -601,7 +603,7 @@ void HTTPRequest::WriteReply(int nStatus, const std::string& strReply)
evhttp_send_reply(req_copy, nStatus, nullptr, nullptr);
// Re-enable reading from the socket. This is the second part of the libevent
// workaround above.
- if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
+ if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
evhttp_connection* conn = evhttp_request_get_connection(req_copy);
if (conn) {
bufferevent* bev = evhttp_connection_get_bufferevent(conn);