/[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

revision 11 by dpavlin, Wed Oct 17 15:39:44 2007 UTC revision 14 by dpavlin, Mon Dec 3 14:25:40 2007 UTC
# Line 5  use warnings; Line 5  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 ">> ",$req->uri, "\n";          my $file;
   
         my $ext;  
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                  # Mireo
21                  $ext = 'png';                  $file = "$3/$1-$2.gif";
22          } elsif ( $req->uri() =~ m!/mt\?.*x=(\d+)&y=(\d+)&zoom=(\d+)! ) {          } elsif ( $req->uri() =~ m!/mt\?.*x=(\d+)&y=(\d+)&zoom=(\d+)! ) {
23                  # Google maps                  # Google maps
24                  $ext = 'png'                  $file = "$3/$1-$2.png";
25          } elsif ( $req->uri() =~ m!/aerial.maps.yimg.com/img.*&x=(\d+)&y=(\d+)&z=(\d+)! ) {          } elsif ( $req->uri() =~ m!/aerial.maps.yimg.com/img.*&x=(\d+)&y=(\d+)&z=(\d+)&v=1\.7! ) {
26                  $ext = 'jpg'                  # 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 ( $ext ) {          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                  my $file = "dump/$3/$1-$2.$ext";                  write_file( "dump/$file", $resp->content );
37                  write_file( $file, $resp->content );                  print "$1x$2 zoom: $3 -> $file ", -s "dump/$file", " bytes\n";
38                  print "$1x$2 zoom: $3 -> $file ", -s $file, " bytes\n";          } else {
39                    print ">> ",$req->uri, "\n";
40          }          }
41    
42    
43  }  }
44    
45  1;  1;

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

  ViewVC Help
Powered by ViewVC 1.1.26