diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2020-04-17 13:58:44 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2020-04-17 19:00:19 +0200 |
commit | 6f8b498d186df5aa08dbb9ca8fdeab6652f1db5e (patch) | |
tree | abb1a03aed34be4a78c78d47e01c78d84bbea831 /src/test/fuzz | |
parent | c189bfd260ca37cbf025ed4790ee7594ce8dbb1c (diff) |
fuzz: http_request workaround for libevent < 2.1.1
Before libevent 2.1.1, internal functions names didn't end with an underscore.
Diffstat (limited to 'src/test/fuzz')
-rw-r--r-- | src/test/fuzz/http_request.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/fuzz/http_request.cpp b/src/test/fuzz/http_request.cpp index 4104c5574d..ebf89749e9 100644 --- a/src/test/fuzz/http_request.cpp +++ b/src/test/fuzz/http_request.cpp @@ -9,6 +9,7 @@ #include <test/fuzz/util.h> #include <event2/buffer.h> +#include <event2/event.h> #include <event2/http.h> #include <event2/http_struct.h> @@ -17,8 +18,24 @@ #include <string> #include <vector> +// workaround for libevent versions before 2.1.1, +// when internal functions didn't have underscores at the end +#if LIBEVENT_VERSION_NUMBER < 0x02010100 +extern "C" int evhttp_parse_firstline(struct evhttp_request*, struct evbuffer*); +extern "C" int evhttp_parse_headers(struct evhttp_request*, struct evbuffer*); +inline int evhttp_parse_firstline_(struct evhttp_request* r, struct evbuffer* b) +{ + return evhttp_parse_firstline(r, b); +} +inline int evhttp_parse_headers_(struct evhttp_request* r, struct evbuffer* b) +{ + return evhttp_parse_headers(r, b); +} +#else extern "C" int evhttp_parse_firstline_(struct evhttp_request*, struct evbuffer*); extern "C" int evhttp_parse_headers_(struct evhttp_request*, struct evbuffer*); +#endif + std::string RequestMethodString(HTTPRequest::RequestMethod m); void test_one_input(const std::vector<uint8_t>& buffer) |