lua: simplify streaming output setup

Setup the init function to simply return:

   {streaming = "tcp"}

or

   {streaming = "http"}

The returned table can have a lot of parameters that don't make sense
together, this should simplify this one case.
pull/13361/head
Jason Ish 1 year ago committed by Victor Julien
parent 02bdea2bce
commit 778a699622

@ -219,10 +219,7 @@ according to the host OS settings.
:: ::
function init (args) function init (args)
local needs = {} return {streaming = "tcp"}
needs["type"] = "streaming"
needs["filter"] = "tcp"
return needs
end end
In case of HTTP body data, the bodies are unzipped and dechunked if applicable. In case of HTTP body data, the bodies are unzipped and dechunked if applicable.
@ -230,10 +227,7 @@ In case of HTTP body data, the bodies are unzipped and dechunked if applicable.
:: ::
function init (args) function init (args)
local needs = {} return {streaming = "http"}
needs["type"] = "streaming"
needs["protocol"] = "http"
return needs
end end
The streaming data will be provided in the ``args`` to the log The streaming data will be provided in the ``args`` to the log

@ -505,7 +505,17 @@ static int LuaScriptInit(const char *filename, LogLuaScriptOptions *options, Log
SCLogDebug("k='%s', v='%s'", k, v); SCLogDebug("k='%s', v='%s'", k, v);
if (strcmp(k,"protocol") == 0 && strcmp(v, "http") == 0) if (strcmp(k, "streaming") == 0) {
options->streaming = 1;
if (strcmp(v, "http") == 0) {
options->alproto = ALPROTO_HTTP1;
} else if (strcmp(v, "tcp") == 0) {
options->tcp_data = 1;
} else {
SCLogError("unsupported streaming argument: %s", v);
goto error;
}
} else if (strcmp(k, "protocol") == 0 && strcmp(v, "http") == 0)
options->alproto = ALPROTO_HTTP1; options->alproto = ALPROTO_HTTP1;
else if (strcmp(k,"protocol") == 0 && strcmp(v, "dns") == 0) else if (strcmp(k,"protocol") == 0 && strcmp(v, "dns") == 0)
options->alproto = ALPROTO_DNS; options->alproto = ALPROTO_DNS;

Loading…
Cancel
Save