12 #include <event2/buffer.h>
13 #include <event2/event.h>
14 #include <event2/http.h>
15 #include <event2/http_struct.h>
30 evhttp_request* evreq = evhttp_request_new(
nullptr,
nullptr);
32 evreq->kind = EVHTTP_REQUEST;
33 evbuffer* evbuf = evbuffer_new();
36 evbuffer_add(evbuf, http_buffer.data(), http_buffer.size());
42 const std::string http_buffer_str =
ToLower(std::string{http_buffer.begin(), http_buffer.end()});
43 if (http_buffer_str.find(
" http://") != std::string::npos || http_buffer_str.find(
" https://") != std::string::npos ||
46 evhttp_request_free(evreq);
53 (void)http_request.GetURI();
54 (void)http_request.GetHeader(
"Host");
55 const std::string header = fuzzed_data_provider.ConsumeRandomLengthString(16);
56 (void)http_request.GetHeader(header);
57 (void)http_request.WriteHeader(header, fuzzed_data_provider.ConsumeRandomLengthString(16));
58 (void)http_request.GetHeader(header);
59 const std::string body = http_request.ReadBody();
61 const CService service = http_request.GetPeer();
65 evhttp_request_free(evreq);
A combination of a network address (CNetAddr) and a (TCP) port.
std::string ToStringAddrPort() const
RequestMethod GetRequestMethod() const
Get request method.
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< uint8_t > 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.