13#include <event2/buffer.h>
14#include <event2/event.h>
15#include <event2/http.h>
16#include <event2/http_struct.h>
31 evhttp_request* evreq = evhttp_request_new(
nullptr,
nullptr);
33 evreq->kind = EVHTTP_REQUEST;
34 evbuffer* evbuf = evbuffer_new();
37 evbuffer_add(evbuf, http_buffer.data(), http_buffer.size());
43 const std::string http_buffer_str =
ToLower(std::string{http_buffer.begin(), http_buffer.end()});
44 if (http_buffer_str.find(
" http://") != std::string::npos || http_buffer_str.find(
" https://") != std::string::npos ||
47 evhttp_request_free(evreq);
55 (void)http_request.GetURI();
56 (void)http_request.GetHeader(
"Host");
57 const std::string header = fuzzed_data_provider.ConsumeRandomLengthString(16);
58 (void)http_request.GetHeader(header);
59 (void)http_request.WriteHeader(header, fuzzed_data_provider.ConsumeRandomLengthString(16));
60 (void)http_request.GetHeader(header);
61 const std::string body = http_request.ReadBody();
63 const CService service = http_request.GetPeer();
67 evhttp_request_free(evreq);
A combination of a network address (CNetAddr) and a (TCP) port.
std::string ToStringAddrPort() const
Helper class that manages an interrupt flag, and allows a thread or signal to interrupt another threa...
std::string RequestMethodString(HTTPRequest::RequestMethod m)
HTTP request method as string - use for logging only.
int evhttp_parse_headers_(struct evhttp_request *, struct evbuffer *)
int evhttp_parse_firstline_(struct evhttp_request *, struct evbuffer *)
FUZZ_TARGET(http_request)
std::vector< B > ConsumeRandomLengthByteVector(FuzzedDataProvider &fuzzed_data_provider, const std::optional< size_t > &max_length=std::nullopt) noexcept
std::string ToLower(std::string_view str)
Returns the lowercase equivalent of the given string.