/[maps]/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 /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 Maps.pm revision 11 by dpavlin, Wed Oct 17 15:39:44 2007 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;
# Line 12  sub http_transaction { Line 12  sub http_transaction {
12      my ($req_mono)  = $args->{req_mono};    # isa Net::Analysis::TCPMonologue      my ($req_mono)  = $args->{req_mono};    # isa Net::Analysis::TCPMonologue
13      my ($resp_mono) = $args->{resp_mono};   # isa Net::Analysis::TCPMonologue      my ($resp_mono) = $args->{resp_mono};   # isa Net::Analysis::TCPMonologue
14    
15      # Print out time between sending last part of request, and receiving          print ">> ",$req->uri, "\n";
16      #  first part of response.  
17      # (Note; these are Net::Analsysis::Time objects)          my $ext;
     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                    $ext = 'png';
22            } elsif ( $req->uri() =~ m!/mt\?.*x=(\d+)&y=(\d+)&zoom=(\d+)! ) {
23                    # Google maps
24                    $ext = 'png'
25            } elsif ( $req->uri() =~ m!/aerial.maps.yimg.com/img.*&x=(\d+)&y=(\d+)&z=(\d+)! ) {
26                    $ext = 'jpg'
27            }
28    
29            if ( $ext ) {
30                  mkdir "dump" unless -e "dump";                  mkdir "dump" unless -e "dump";
31                  mkdir "dump/$3" unless -e "dump/$3";                  mkdir "dump/$3" unless -e "dump/$3";
32                  write_file( "dump/$3/$1-$2.gif", $resp->content );                  my $file = "dump/$3/$1-$2.$ext";
33                    write_file( $file, $resp->content );
34                    print "$1x$2 zoom: $3 -> $file ", -s $file, " bytes\n";
35          }          }
36    
37  }  }
38    
39  1;  1;
40    
41  =head1 NAME  =head1 NAME
42    
43  Net::Analysis::Listener::Mireo - looking at HTTP transactions  Net::Analysis::Listener::Maps - looking at HTTP transactions
44    
45   $ perl -MNet::Analysis -e main HTTP Mireo t/t1_google.tcp   $ perl -MNet::Analysis -e main HTTP Maps maps_dump.tcp
46    

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

  ViewVC Help
Powered by ViewVC 1.1.26