Skip to content

Instantly share code, notes, and snippets.

@sethhall
Last active December 19, 2015 12:09
Show Gist options
  • Select an option

  • Save sethhall/5952451 to your computer and use it in GitHub Desktop.

Select an option

Save sethhall/5952451 to your computer and use it in GitHub Desktop.
grabbing content-disposition headers only in certain cases.
@load base/protocols/http
const watchlist_url_patterns = /^.*/test.php\// &redef;
redef record Conn::Info += {
content_disposition: string &optional &log;
};
event http_all_headers(c: connection, is_orig: bool, hlist: mime_header_list)
{
if ( ! is_orig || c$http$method != "POST" )
return;
local url = HTTP::build_url(c$http);
if ( HTTP::watchlist_url_patterns in url )
{
for ( i in hlist )
{
local hdr = hlist[i]i$name;
local value = hlist[i]$value;
if ( hdr == "CONTENT-DISPOSITION" )
c$http$content_disposition = value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment