]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #2100 in SNORT/snort3 from ~KATHARVE/snort3:nhi_refactor_print_bod...
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 24 Mar 2020 14:01:40 +0000 (14:01 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Tue, 24 Mar 2020 14:01:40 +0000 (14:01 +0000)
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

src/service_inspectors/http_inspect/http_msg_body.cc
src/service_inspectors/http_inspect/http_msg_body.h
src/service_inspectors/http_inspect/http_msg_body_chunk.cc
src/service_inspectors/http_inspect/http_msg_body_cl.cc
src/service_inspectors/http_inspect/http_msg_body_h2.cc
src/service_inspectors/http_inspect/http_msg_body_old.cc

index 0f35cf857b783f35d426ca9f6eb00fedef3a1250..c3cdba2a6b380dee1e96b033052909efde5ce086 100644 (file)
@@ -279,8 +279,10 @@ const Field& HttpMsgBody::get_classic_client_body()
 
 #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]);
index b086588b74875bfdb52057dfc9395d28a87539cf..c8407933493a612028115f7e76079aacc8b08f2b 100644 (file)
@@ -51,7 +51,7 @@ protected:
     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:
index 5acf0dcf28a6276764b51a732c86ea929bf20ef4..dc4c1b24fa3974f4f3422a34b534261394bf0b2b 100644 (file)
@@ -55,9 +55,7 @@ void HttpMsgBodyChunk::update_flow()
 #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
 
index 6ac9611d86b43d938e0e7ebec0d63ad76703ea71..1809595bd81d85cb797fe736f6f8682ae18483f7 100644 (file)
@@ -41,9 +41,7 @@ void HttpMsgBodyCl::update_flow()
 #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
 
index ea0a87551c7bed19586e93c4dc076121f9611dde..9911a9b2d05919f35b46528e762fcba2ac3a1e13 100644 (file)
@@ -43,9 +43,7 @@ void HttpMsgBodyH2::update_flow()
 #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
 
index 6e68953c36b4cd8a089206bffd26b2418fe7d337..102659a7fd234a8ca2f9c0ad3a1ebc62ef83ce0b 100644 (file)
@@ -33,9 +33,7 @@ void HttpMsgBodyOld::update_flow()
 #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