The evhttp_connection_get_peer in the libevent has now const char** #23606

issue Perlover openend this issue on November 26, 2021
  1. Perlover commented at 4:18 pm on November 26, 2021: contributor

    The developers of the libevent library changed the parameter type, which now conflicts with your parameter conversion.

    Expected behavior

    A compilation without errors

    Actual behavior

    A compilation from sources (the current master branch today) shows to me a following errors:

     0  CXX      libbitcoin_server_a-httpserver.o
     1httpserver.cpp: In member function 'CService HTTPRequest::GetPeer() const':
     2httpserver.cpp:600:41: error: invalid conversion from 'char**' to 'const char**' [-fpermissive]
     3  600 |         evhttp_connection_get_peer(con, (char**)&address, &port);
     4      |                                         ^~~~~~~~~~~~~~~~
     5      |                                         |
     6      |                                         char**
     7In file included from ./support/events.h:12,
     8                 from httpserver.cpp:35:
     9/home/bitcoin/include/event2/http.h:981:18: note:   initializing argument 2 of 'void evhttp_connection_get_peer(evhttp_connection*, const char**, uint16_t*)'
    10  981 |     const char **address, ev_uint16_t *port);
    11      |     ~~~~~~~~~~~~~^~~~~~~
    

    I researched the problem and found that the libevent which I use (from sources) has the related commit:

     0commit a18301a2bb160ff7c3ffaf5b7653c39ffe27b385
     1Author: Leon M. George <leon@georgemail.eu>
     2Date:   Tue Sep 8 15:38:16 2020 +0200
     3
     4    http: const out address param to evcon_get_peer
     5
     6diff --git a/http.c b/http.c
     7index abd255dc..8afb3600 100644
     8--- a/http.c
     9+++ b/http.c
    10@@ -2754,7 +2754,7 @@ evhttp_connection_set_closecb(struct evhttp_connection *evcon,
    11 
    12 void
    13 evhttp_connection_get_peer(struct evhttp_connection *evcon,
    14-    char **address, ev_uint16_t *port)
    15+    const char **address, ev_uint16_t *port)
    

    To reproduce

    May be you have to have a following software:

    • gcc v11.2.0
    • libevent with commit a18301a2bb160ff7c3ffaf5b7653c39ffe27b385 (Tue Sep 8 15:38:16 2020 +0200)
    • bitcoind current master branch (at 2021-11-26)

    System information

  2. Perlover added the label Bug on Nov 26, 2021
  3. Perlover referenced this in commit d5b9f70958 on Nov 26, 2021
  4. fanquake deleted a comment on Nov 28, 2021
  5. laanwj referenced this in commit 767ee2e3a1 on Jan 13, 2022
  6. sidhujag referenced this in commit b8dfbdb946 on Jan 14, 2022
  7. Perlover closed this on May 14, 2022

  8. DrahtBot locked this on May 14, 2023


Perlover

Labels
Bug


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-03 10:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me