30 HTTPRequest http_request;
33 if (!http_request.LoadControlData(
reader))
return;
34 if (!http_request.LoadHeaders(
reader))
return;
35 if (!http_request.LoadBody(
reader))
return;
36 }
catch (
const std::runtime_error&) {
42 (void)http_request.GetURI();
43 (void)http_request.GetHeader(
"Host");
45 (void)http_request.GetHeader(header);
47 (void)http_request.GetHeader(header);
53 const std::string body = http_request.ReadBody();
54 const auto [has_transfer_encoding, transfer_encoding] = http_request.GetHeader(
"Transfer-Encoding");
55 const auto [has_content_length, content_length] = http_request.GetHeader(
"Content-Length");
56 if (has_transfer_encoding &&
ToLower(transfer_encoding) ==
"chunked") {
59 }
else if (has_content_length) {
61 const auto parsed_length{ToIntegral<uint64_t>(content_length)};
63 assert(body.size() == *parsed_length);
std::string ConsumeRandomLengthString(size_t max_length)
std::string_view RequestMethodString(HTTPRequestMethod m)
HTTP request method as string - use for logging only.
FUZZ_TARGET(http_request)
constexpr uint64_t MAX_BODY_SIZE
Maximum size of an HTTP request body.
constexpr size_t MAX_HEADERS_SIZE
Maximum size of each headers line in an HTTP request, also the maximum size of all headers total.
std::string ToLower(std::string_view str)
Returns the lowercase equivalent of the given string.
FuzzedDataProvider & fuzzed_data_provider