/[maps]/lib/Net/Analysis/Listener/Maps.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/Net/Analysis/Listener/Maps.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Mireo.pm revision 1 by dpavlin, Mon Oct 15 21:14:50 2007 UTC lib/Net/Analysis/Listener/Maps.pm revision 35 by dpavlin, Mon Sep 29 13:43:37 2008 UTC
# Line 1  Line 1 
1  package Net::Analysis::Listener::Mireo;  package Net::Analysis::Listener::Maps;
2    
3  use strict;  use strict;
4  use warnings;  use warnings;
5  use base qw(Net::Analysis::Listener::Base);  use base qw(Net::Analysis::Listener::Base);
6  use File::Slurp;  use File::Slurp;
7    
8    my $i = 0;
9    
10  sub http_transaction {  sub http_transaction {
11      my ($self, $args) = @_;      my ($self, $args) = @_;
12      my ($req)       = $args->{req};         # isa HTTP::Request      my ($req)       = $args->{req};         # isa HTTP::Request
# Line 12  sub http_transaction { Line 14  sub http_transaction {
14      my ($req_mono)  = $args->{req_mono};    # isa Net::Analysis::TCPMonologue      my ($req_mono)  = $args->{req_mono};    # isa Net::Analysis::TCPMonologue
15      my ($resp_mono) = $args->{resp_mono};   # isa Net::Analysis::TCPMonologue      my ($resp_mono) = $args->{resp_mono};   # isa Net::Analysis::TCPMonologue
16    
17      # Print out time between sending last part of request, and receiving          my $file;
     #  first part of response.  
     # (Note; these are Net::Analsysis::Time objects)  
     my ($network_wait_time) = $resp_mono->t_start() - $req_mono->t_end();  
     printf "%-50.50s: %8.2f\n", $req->uri(), $network_wait_time;  
18    
19          if ( $req->uri() =~ m!/GElin/MapSrv\.aspx\?lwM=(\d+)&twM=(\d+)&zf=(\d+)! ) {          if ( $req->uri() =~ m!/GElin/MapSrv\.aspx\?lwM=(\d+)&twM=(\d+)&zf=(\d+)! ) {
20                    # Mireo
21                    $file = "$3/$1-$2.gif";
22            } elsif ( $req->uri() =~ m!/mt\?.*x=(\d+).*?&y=(\d+).*?&z=(\d+)! ) {
23                    # Google maps
24                    $file = "$3/$1-$2.png";
25            } elsif ( $req->uri() =~ m!/aerial.maps.yimg.com/img.*&x=(\d+)&y=(\d+)&z=(\d+)&v=1\.7! ) {
26                    # Yahoo maps
27                    $file = "$3/$1-$2.jpg";
28            } elsif ( $req->uri() =~ m!/GElin/mireo.NET.MapSearchWeb! ) {
29                    $file = "foo$i";
30                    $i++;
31            }
32    
33            if ( $file ) {
34                  mkdir "dump" unless -e "dump";                  mkdir "dump" unless -e "dump";
35                  mkdir "dump/$3" unless -e "dump/$3";                  mkdir "dump/$3" unless -e "dump/$3";
36                  write_file( "dump/$3/$1-$2.gif", $resp->content );                  write_file( "dump/$file", $resp->content );
37                    print "$1x$2 zoom: $3 -> $file ", -s "dump/$file", " bytes\n";
38            } else {
39                    print ">> ",$req->uri, "\n";
40          }          }
41    
42    
43  }  }
44    
45  1;  1;
46    
47  =head1 NAME  =head1 NAME
48    
49  Net::Analysis::Listener::Mireo - looking at HTTP transactions  Net::Analysis::Listener::Maps - looking at HTTP transactions
50    
51   $ perl -MNet::Analysis -e main HTTP Mireo t/t1_google.tcp   $ perl -MNet::Analysis -e main HTTP Maps maps_dump.tcp
52    

Legend:
Removed from v.1  
changed lines
  Added in v.35

  ViewVC Help
Powered by ViewVC 1.1.26