]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
lua/streaming: update tests for changes to output streaming
authorJason Ish <jason.ish@oisf.net>
Mon, 2 Jun 2025 22:42:58 +0000 (16:42 -0600)
committerJason Ish <jason.ish@oisf.net>
Tue, 3 Jun 2025 17:37:14 +0000 (11:37 -0600)
Handle the stream data passed as arguments to the log function.

tests/lua-output-streaming/streaming-http.lua
tests/lua-output-streaming/streaming-tcp.lua

index f105df39acdeb0e94815916588b376acb8e84e44..e998a7f8e099061d1568fe97d0a4bf0715712648 100644 (file)
@@ -17,8 +17,8 @@ function log(args)
     f = flow.get()
     ts = f:timestring_legacy()
     ipver, srcip, dstip, proto, sp, dp = f:tuple()
-    data, data_open, data_close = SCStreamingBuffer()
-    logger.notice("called with data_open " .. tostring(data_open) .. " data_close " .. tostring(data_close));
+    local stream = args["stream"]
+    logger.notice("called with data_open " .. tostring(stream["open"]) .. " data_close " .. tostring(stream["close"]) .. " to_server " .. tostring(stream["to_server"]) .. " to_client " .. tostring(stream["to_client"]));
     filename = filepath .. "/http-" .. proto .. "-" .. srcip .. "-" .. dstip .. "-" .. sp .. "-" .. dp
 
     file_mode = "a"
@@ -27,7 +27,7 @@ function log(args)
     end
 
     file = assert(io.open(filename, file_mode))
-    file:write (data)
+    file:write (stream["data"])
     file:flush()
     file.close(file)
 end
index 3cae85a0fa40cc6a48b2ad39e077404083c8a702..11ef65baccb72c9b3b60f42f886843cf21afd6ec 100644 (file)
@@ -17,16 +17,16 @@ function log(args)
     f = flow.get()
     ts = f:timestring_legacy()
     ipver, srcip, dstip, proto, sp, dp = f:tuple()
-    data, data_open, data_close = SCStreamingBuffer()
+    local stream = args["stream"]
     filename = filepath .. "/" .. proto .. "-" .. srcip .. "-" .. dstip .. "-" .. sp .. "-" .. dp
 
     file_mode = "a"
-    if (data_open == true) then
+    if (stream["open"] == true) then
         file_mode = "w"
     end
 
     file = assert(io.open(filename, file_mode))
-    file:write (data)
+    file:write (stream["data"])
     file:flush()
     file.close(file)
 end