zeek/testing/btest/scripts/base/utils/active-http.test
Seth Hall dad8c9a74d Update for the active http test to force it to use ipv4.
It was having trouble because the httpd.py script would start up
a webserver on ipv4 but on some platforms and with some versions
of curl "localhost" will attempt to connect to ::1.
2014-05-15 21:00:37 -04:00

28 lines
681 B
Text

# @TEST-REQUIRES: which python
# @TEST-REQUIRES: which curl
#
# @TEST-EXEC: btest-bg-run httpd python $SCRIPTS/httpd.py --max 1 --addr=127.0.0.1
# @TEST-EXEC: sleep 3
# @TEST-EXEC: btest-bg-run bro bro -b %INPUT
# @TEST-EXEC: btest-bg-wait 15
# @TEST-EXEC: btest-diff bro/.stdout
@load base/utils/active-http
@load base/frameworks/communication # let network-time run. otherwise there are no heartbeats...
redef exit_only_after_terminate = T;
event bro_init()
{
local req = ActiveHTTP::Request($url="127.0.0.1:32123");
when ( local resp = ActiveHTTP::request(req) )
{
print resp;
terminate();
}
timeout 1min
{
print "HTTP request timeout";
terminate();
}
}