mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 12:08:20 +00:00
[FIX] Add files to result table even if the files are empty
This commit is contained in:
parent
80656d5294
commit
4c305d6b92
2 changed files with 13 additions and 1 deletions
|
@ -65,12 +65,14 @@ function request2curl(r: Request, bodyfile: string, headersfile: string): string
|
|||
cmd = fmt("%s -m %.0f", cmd, r$max_time);
|
||||
|
||||
if ( r?$client_data )
|
||||
cmd = fmt("%s -d -", cmd);
|
||||
cmd = fmt("%s -d @-", cmd);
|
||||
|
||||
if ( r?$addl_curl_args )
|
||||
cmd = fmt("%s %s", cmd, r$addl_curl_args);
|
||||
|
||||
cmd = fmt("%s \"%s\"", cmd, str_shell_escape(r$url));
|
||||
# hack so the bodyfile will exsist even if curl did not write one.
|
||||
cmd = fmt("%s && touch %s", cmd, str_shell_escape(bodyfile));
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,16 @@ event Input::end_of_data(name: string, source:string)
|
|||
|
||||
local track_file = parts[2];
|
||||
|
||||
# If the file is empty, add it to the result$files table
|
||||
# this is needed because it is expected that the file was read
|
||||
# even if it was empty
|
||||
local result = results[name];
|
||||
if ( ! result?$files )
|
||||
result$files = table();
|
||||
|
||||
if ( track_file !in result$files )
|
||||
result$files[track_file] = vector(source);
|
||||
|
||||
Input::remove(name);
|
||||
|
||||
if ( name !in pending_files )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue