1 |
dpavlin |
1 |
package Net::Analysis::Listener::Mireo; |
2 |
|
|
|
3 |
|
|
use strict; |
4 |
|
|
use warnings; |
5 |
|
|
use base qw(Net::Analysis::Listener::Base); |
6 |
|
|
use File::Slurp; |
7 |
|
|
|
8 |
|
|
sub http_transaction { |
9 |
|
|
my ($self, $args) = @_; |
10 |
|
|
my ($req) = $args->{req}; # isa HTTP::Request |
11 |
|
|
my ($resp) = $args->{resp}; # isa HTTP::Response |
12 |
|
|
my ($req_mono) = $args->{req_mono}; # isa Net::Analysis::TCPMonologue |
13 |
|
|
my ($resp_mono) = $args->{resp_mono}; # isa Net::Analysis::TCPMonologue |
14 |
|
|
|
15 |
|
|
# Print out time between sending last part of request, and receiving |
16 |
|
|
# first part of response. |
17 |
|
|
# (Note; these are Net::Analsysis::Time objects) |
18 |
|
|
my ($network_wait_time) = $resp_mono->t_start() - $req_mono->t_end(); |
19 |
|
|
printf "%-50.50s: %8.2f\n", $req->uri(), $network_wait_time; |
20 |
|
|
|
21 |
|
|
if ( $req->uri() =~ m!/GElin/MapSrv\.aspx\?lwM=(\d+)&twM=(\d+)&zf=(\d+)! ) { |
22 |
|
|
mkdir "dump" unless -e "dump"; |
23 |
|
|
mkdir "dump/$3" unless -e "dump/$3"; |
24 |
|
|
write_file( "dump/$3/$1-$2.gif", $resp->content ); |
25 |
|
|
} |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
1; |
29 |
|
|
|
30 |
|
|
=head1 NAME |
31 |
|
|
|
32 |
|
|
Net::Analysis::Listener::Mireo - looking at HTTP transactions |
33 |
|
|
|
34 |
|
|
$ perl -MNet::Analysis -e main HTTP Mireo t/t1_google.tcp |
35 |
|
|
|