You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2003/05/13 03:06:47 UTC

cvs commit: modperl-2.0/t/preconnection/TestPreConnection note.pm

stas        2003/05/12 18:06:47

  Modified:    t/preconnection note.t
               t/preconnection/TestPreConnection note.pm
  Log:
  do something useful in the preconnection handler: retrieve the remote ip
  address, so we can compare it with the client's real ip address
  
  Revision  Changes    Path
  1.3       +5 -3      modperl-2.0/t/preconnection/note.t
  
  Index: note.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/preconnection/note.t,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- note.t	18 Apr 2003 06:18:58 -0000	1.2
  +++ note.t	13 May 2003 01:06:46 -0000	1.3
  @@ -7,12 +7,14 @@
   
   my $module = "TestPreConnection::note";
   Apache::TestRequest::module($module);
  -my $hostport = Apache::TestRequest::hostport(Apache::Test::config());
  +my $config = Apache::Test::config();
  +my $hostport = Apache::TestRequest::hostport($config);
   my $location = "http://$hostport/" . Apache::TestRequest::module2path($module);
  +my $remote_addr = $config->{vars}->{remote_addr};
   t_debug("connecting to $location");
   plan tests => 1;
   
   ok t_cmp(
  -    'ok', 
  -    GET_BODY($location),
  +    $remote_addr,
  +    GET_BODY_ASSERT($location),
       "connection notes");
  
  
  
  1.4       +3 -1      modperl-2.0/t/preconnection/TestPreConnection/note.pm
  
  Index: note.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/preconnection/TestPreConnection/note.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- note.pm	18 Apr 2003 06:18:58 -0000	1.3
  +++ note.pm	13 May 2003 01:06:47 -0000	1.4
  @@ -10,7 +10,9 @@
   sub handler {
       my Apache::Connection $c = shift;
   
  -    $c->notes->set(preconnection => 'ok');
  +    my $ip = $c->remote_ip;
  +
  +    $c->notes->set(preconnection => $ip);
   
       return Apache::OK;
   }