]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1977 in SNORT/snort3 from ~THOPETER/snort3:nhttp131 to master
authorMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 3 Feb 2020 15:21:20 +0000 (15:21 +0000)
committerMike Stepanek (mstepane) <mstepane@cisco.com>
Mon, 3 Feb 2020 15:21:20 +0000 (15:21 +0000)
Squashed commit of the following:

commit 4202f01e2fdc2a3e0fb5178ecb6de438b264a5e6
Author: Tom Peters <thopeter@cisco.com>
Date:   Fri Jan 31 13:59:15 2020 -0500

    http_inspect: refactoring

src/service_inspectors/http_inspect/http_context_data.cc
src/service_inspectors/http_inspect/http_context_data.h

index e9b912a60567dde24d029673ce78b59d0403b0a5..bb6abb3ce94905b1f4a0aabca86639ddd2ddf382 100644 (file)
@@ -34,25 +34,10 @@ unsigned HttpContextData::ips_id = 0;
 HttpMsgSection* HttpContextData::get_snapshot(const Packet* p)
 {
     assert(p != nullptr);
-
-    if (Http2FlowData::inspector_id != 0)
-    {
-        const Http2FlowData* const h2i_flow_data =
-            (Http2FlowData*)p->flow->get_flow_data(Http2FlowData::inspector_id);
-        if (h2i_flow_data != nullptr)
-            return h2i_flow_data->get_hi_msg_section();
-    }
-
-    HttpContextData* hcd = (HttpContextData*)DetectionEngine::get_data(HttpContextData::ips_id,
-        p->context);
-
-    if ( !hcd )
-        return nullptr;
-
-    return hcd->current_section;
+    return get_snapshot(p->flow, p->context);
 }
 
-HttpMsgSection* HttpContextData::get_snapshot(const Flow* flow)
+HttpMsgSection* HttpContextData::get_snapshot(const Flow* flow, IpsContext* context)
 {
     assert(flow != nullptr);
 
@@ -65,7 +50,7 @@ HttpMsgSection* HttpContextData::get_snapshot(const Flow* flow)
     }
 
     HttpContextData* hcd = (HttpContextData*)DetectionEngine::get_data(HttpContextData::ips_id,
-        nullptr);
+        context);
 
     if ( !hcd )
         return nullptr;
index 0114d73dd728326ee87903a6b031f359e6bd4575..2ade57f1510071ddb6ba9eca3e30c67189af4173 100644 (file)
@@ -33,7 +33,8 @@ public:
     static void init()
     { ips_id = IpsContextData::get_ips_id(); }
     static HttpMsgSection* get_snapshot(const snort::Packet* p);
-    static HttpMsgSection* get_snapshot(const snort::Flow* flow);
+    static HttpMsgSection* get_snapshot(const snort::Flow* flow,
+        snort::IpsContext* context = nullptr);
     static void save_snapshot(HttpMsgSection* section);
     static HttpMsgSection* clear_snapshot(snort::IpsContext* context);
     static unsigned ips_id;