httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: httpd-test/perl-framework/Apache-Test Changes
Date Thu, 05 Aug 2004 07:00:10 GMT
stas        2004/08/05 00:00:10

  Modified:    perl-framework/Apache-Test/lib/Apache TestCommonPost.pm
               perl-framework/Apache-Test Changes
  Log:
  fix Apache::TestCommonPost::lwp_do to work with LWP 5.800 ($res->content()
  doesn't allow CODE refs anymore, instead used content_ref to avoid
  huge strings copy)
  
  Revision  Changes    Path
  1.4       +21 -11    httpd-test/perl-framework/Apache-Test/lib/Apache/TestCommonPost.pm
  
  Index: TestCommonPost.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestCommonPost.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- TestCommonPost.pm	4 Mar 2004 05:51:31 -0000	1.3
  +++ TestCommonPost.pm	5 Aug 2004 07:00:09 -0000	1.4
  @@ -65,20 +65,30 @@
   
   sub lwp_do {
       my $length = shift;
  -    my $remain = $length;
  -
  -    use constant BUF_SIZE => 8192;
  -
  -    my $content = sub {
  -        my $bytes = $remain < BUF_SIZE ? $remain : BUF_SIZE;
  -        my $buf = 'a' x $bytes;
  -        $remain -= $bytes;
  -        $buf;
  -    };
   
       my $request = HTTP::Request->new(POST => $Location);
       $request->header('Content-length' => $length);
  -    $request->content($content);
  +
  +    if (LWP->VERSION >= 5.800) {
  +        $request->content_ref(\('a' x $length));
  +    } else {
  +        # before LWP 5.800 there was no way to tell HTTP::Message not
  +        # to copy the string, there is a settable content_ref since
  +        # 5.800
  +        use constant BUF_SIZE => 8192;
  +
  +        my $remain = $length;
  +        my $content = sub {
  +            my $bytes = $remain < BUF_SIZE ? $remain : BUF_SIZE;
  +            my $buf = 'a' x $bytes;
  +            $remain -= $bytes;
  +            $buf;
  +        };
  +
  +        $request->content($content);
  +    }
  +
  +
   
       my $response = $UA->request($request);
   
  
  
  
  1.155     +4 -0      httpd-test/perl-framework/Apache-Test/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
  retrieving revision 1.154
  retrieving revision 1.155
  diff -u -u -r1.154 -r1.155
  --- Changes	4 Aug 2004 15:26:48 -0000	1.154
  +++ Changes	5 Aug 2004 07:00:10 -0000	1.155
  @@ -8,6 +8,10 @@
   
   =item 1.13-dev
   
  +fix Apache::TestCommonPost::lwp_do to work with LWP 5.800
  +($res->content() doesn't allow CODE refs anymore, instead used
  +content_ref to avoid huge strings copy) [Stas]
  +
   add @PHP_MODULE@ extra.conf.in substitution variable, which selects
   mod_php4 or mod_php5 as appropriate.  [Geoffrey Young]
   
  
  
  

Mime
View raw message