mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00

This reverts commit fc267d010d
.
There were some diffs caused by this in external test suites I'm
unsure about, I'm going to go over optimizations more closely in
a different branch.
36 lines
1 KiB
Text
36 lines
1 KiB
Text
@load ./main
|
|
@load ./utils
|
|
@load base/utils/conn-ids
|
|
@load base/frameworks/file-analysis/main
|
|
|
|
module HTTP;
|
|
|
|
export {
|
|
## Determines whether the default :bro:see:`get_file_handle` handler
|
|
## is used to return file handles to the file analysis framework.
|
|
## Redefine to true in order to provide a custom handler which overrides
|
|
## the default HTTP.
|
|
const disable_default_file_handle_provider: bool = F &redef;
|
|
|
|
## Default file handle provider for HTTP.
|
|
function get_file_handle(c: connection, is_orig: bool): string
|
|
{
|
|
if ( ! c?$http ) return "";
|
|
|
|
if ( c$http$range_request )
|
|
return fmt("%s %s %s %s", ANALYZER_HTTP, is_orig, c$id$orig_h,
|
|
build_url(c$http));
|
|
|
|
return fmt("%s %s %s %s %s", ANALYZER_HTTP, c$start_time, is_orig,
|
|
c$http$trans_depth, id_string(c$id));
|
|
}
|
|
}
|
|
|
|
module GLOBAL;
|
|
|
|
event get_file_handle(tag: AnalyzerTag, c: connection, is_orig: bool)
|
|
{
|
|
if ( tag != ANALYZER_HTTP ) return;
|
|
if ( HTTP::disable_default_file_handle_provider ) return;
|
|
return_file_handle(HTTP::get_file_handle(c, is_orig));
|
|
}
|