Skip to content

Commit a15388c

Browse files
committed
Merge bitcoin/bitcoin#27949: http: update libevent workaround to correct version
79d343a http: update libevent workaround to correct version (stickies-v) Pull request description: The libevent bug described in libevent/libevent@5ff8eb2 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](libevent/libevent@5b40744) and [b25813800f97179b2355a7b4b3557e6a7f568df2](libevent/libevent@b258138). 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 bitcoin/bitcoin#27909 (comment), where a reverse workaround was incorrectly applied to the wrong version range. ACKs for top commit: fanquake: ACK 79d343a Tree-SHA512: 56d2576411cf38e56d0976523fec951e032a48e35af293ed1ef3af820af940b26f779b9197baaed6d8b79bd1c7f7334646b9d73f80610d63cffbc955958ca8a0
2 parents ec822e8 + 79d343a commit a15388c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/httpserver.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
221221
}, nullptr);
222222
}
223223

224-
// Disable reading to work around a libevent bug, fixed in 2.2.0.
225-
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
224+
// Disable reading to work around a libevent bug, fixed in 2.1.9
225+
// See https://github.com/libevent/libevent/commit/5ff8eb26371c4dc56f384b2de35bea2d87814779
226+
// and https://github.com/bitcoin/bitcoin/pull/11593.
227+
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
226228
evhttp_connection* conn = evhttp_request_get_connection(req);
227229
if (conn) {
228230
bufferevent* bev = evhttp_connection_get_bufferevent(conn);
@@ -601,7 +603,7 @@ void HTTPRequest::WriteReply(int nStatus, const std::string& strReply)
601603
evhttp_send_reply(req_copy, nStatus, nullptr, nullptr);
602604
// Re-enable reading from the socket. This is the second part of the libevent
603605
// workaround above.
604-
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02020001) {
606+
if (event_get_version_number() >= 0x02010600 && event_get_version_number() < 0x02010900) {
605607
evhttp_connection* conn = evhttp_request_get_connection(req_copy);
606608
if (conn) {
607609
bufferevent* bev = evhttp_connection_get_bufferevent(conn);

0 commit comments

Comments
 (0)