Squashed commit of the following:
commit
9c9226cea9e366bfd8be4da464ba1428497c9221
Author: Katura Harvey <katharve@cisco.com>
Date: Mon Mar 23 16:54:22 2020 -0400
http_inspect: refactor print_section for message bodies
#ifdef REG_TEST
// Common elements of print_section() for body sections
-void HttpMsgBody::print_body_section(FILE* output)
+void HttpMsgBody::print_body_section(FILE* output, const char* body_type_str)
{
+ HttpMsgSection::print_section_title(output, body_type_str);
+ fprintf(output, "octets seen %" PRIi64 "\n", body_octets);
detect_data.print(output, "Detect data");
get_classic_buffer(HTTP_BUFFER_CLIENT_BODY, 0, 0).print(output,
HttpApi::classic_buffer_names[HTTP_BUFFER_CLIENT_BODY-1]);
bool first_body;
#ifdef REG_TEST
- void print_body_section(FILE* output);
+ void print_body_section(FILE* output, const char* body_type_str);
#endif
private:
#ifdef REG_TEST
void HttpMsgBodyChunk::print_section(FILE* output)
{
- HttpMsgSection::print_section_title(output, "chunked body");
- fprintf(output, "Cumulative octets %" PRIi64 "\n", body_octets);
- print_body_section(output);
+ print_body_section(output, "chunked body");
}
#endif
#ifdef REG_TEST
void HttpMsgBodyCl::print_section(FILE* output)
{
- HttpMsgSection::print_section_title(output, "Content-Length body");
- fprintf(output, "octets seen %" PRIi64 "\n", body_octets);
- print_body_section(output);
+ print_body_section(output, "Content-Length body");
}
#endif
#ifdef REG_TEST
void HttpMsgBodyH2::print_section(FILE* output)
{
- HttpMsgSection::print_section_title(output, "HTTP/2 body");
- fprintf(output, "octets seen %" PRIi64 "\n", body_octets);
- print_body_section(output);
+ print_body_section(output, "HTTP/2 body");
}
#endif
#ifdef REG_TEST
void HttpMsgBodyOld::print_section(FILE* output)
{
- HttpMsgSection::print_section_title(output, "old-style body");
- fprintf(output, "octets seen %" PRIi64 "\n", body_octets);
- print_body_section(output);
+ print_body_section(output, "old-style body");
}
#endif