1
package probes::EchoPingHttp;
5
probes::EchoPingHttp - an echoping(1) probe for SmokePing
9
Measures HTTP roundtrip times (web servers and caches) for SmokePing.
16
binary = /usr/bin/echoping # mandatory
27
port = 80 # default value anyway
31
Supported probe-specific variables: those specified in EchoPing(3pm)
34
Supported target-specific variables:
38
=item those specified in EchoPing(3pm) documentation
40
except I<fill>, I<size> and I<udp>.
44
The URL to be requested from the web server or cache. Can be either relative
45
(/...) for web servers or absolute (http://...) for caches.
49
The TCP port to use. The default is 80.
53
The echoping(1) "-A" option: force the proxy to ignore the cache.
54
Enabled if the value is anything other than 'no' or '0'.
58
The echoping(1) "-a" option: force the proxy to revalidate data with original
59
server. Enabled if the value is anything other than 'no' or '0'.
65
Niko Tyni E<lt>ntyni@iki.fiE<gt>
69
EchoPing(3pm), EchoPingHttps(3pm)
74
use base qw(probes::EchoPing);
79
# HTTP doesn't fit with filling or size
80
my $arghashref = $self->features;
81
delete $arghashref->{size};
82
delete $arghashref->{fill};
85
# tag the port number after the hostname
90
my $host = $self->SUPER::make_host($target);
91
my $port = $target->{vars}{port};
92
$port = $self->{properties}{port} unless defined $port;
94
$host .= ":$port" if defined $port;
101
my $url = $target->{vars}{url};
102
$url = $self->{properties}{url} unless defined $url;
103
$url = "/" unless defined $url;
105
my @args = ("-h", $url);
109
my $ignore = $target->{vars}{ignore_cache};
110
$ignore = $self->{properties}{ignore_cache}
111
unless defined $ignore;
113
if (defined $ignore and $ignore ne "no"
115
push @args, "-A" if $ignore and not exists $self->{_disabled}{A};
117
# -a : force cache to revalidate the data
118
my $revalidate = $target->{vars}{revalidate_data};
119
$revalidate = $self->{properties}{revalidate_data}
120
unless defined $revalidate;
121
$revalidate= 1 if (defined $revalidate and $revalidate ne "no"
122
and $revalidate != 0);
123
push @args, "-a" if $revalidate and not exists $self->{_disabled}{a};
130
my $bin = $self->{properties}{binary};
131
croak("Your echoping binary doesn't support HTTP")
132
if `$bin -h/ foo 2>&1` =~ /(invalid option|not compiled|usage)/i;
133
if (`$bin -a -h/ foo 2>&1` =~ /(invalid option|not compiled|usage)/i) {
134
carp("Note: your echoping binary doesn't support revalidating (-a), disabling it");
135
$self->{_disabled}{a} = undef;
138
if (`$bin -A -h/ foo 2>&1` =~ /(invalid option|not compiled|usage)/i) {
139
carp("Note: your echoping binary doesn't support ignoring cache (-A), disabling it");
140
$self->{_disabled}{A} = undef;
143
$self->SUPER::test_usage;
148
return "HTTP pings using echoping(1)";