perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestAPI content_encoding.pm request_rec.pm
Date Fri, 23 Jul 2004 23:46:12 GMT
stas        2004/07/23 16:46:11

  Modified:    t/response/TestAPI request_rec.pm
  Added:       t/api    content_encoding.t
               t/response/TestAPI content_encoding.pm
  Log:
  content_encoding test
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/api/content_encoding.t
  
  Index: content_encoding.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  plan tests => 1, have_min_module_version("Compress::Zlib", "1.09");
  
  my $location = '/TestAPI__content_encoding';
  
  my $expected = 'This is a clear text';
  
  my $res = POST $location, content => $expected;
  
  my $received = $res->content;
  #t_debug($received);
  if ($res->header('Content-Encoding') =~ /gzip/) {
      require Compress::Zlib;
  
      # gzip already produces data in a network order, so no extra
      # transformation seem to be necessary
      $received = Compress::Zlib::memGunzip($received);
  }
  
  ok t_cmp $received, $expected, "Content-Encoding: gzip test";
  
  
  
  
  1.23      +2 -2      modperl-2.0/t/response/TestAPI/request_rec.pm
  
  Index: request_rec.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -u -r1.22 -r1.23
  --- request_rec.pm	23 Jul 2004 21:04:50 -0000	1.22
  +++ request_rec.pm	23 Jul 2004 23:46:11 -0000	1.23
  @@ -99,8 +99,8 @@
   
       ok $r->handler;
   
  -    #content_encoding
  -    #content_language
  +    # content_encoding is tested in TestAPI::content_encoding
  +
       #content_languages
   
       #user
  
  
  
  1.1                  modperl-2.0/t/response/TestAPI/content_encoding.pm
  
  Index: content_encoding.pm
  ===================================================================
  package TestAPI::content_encoding;
  
  # tests: $r->content_encoding("gzip");
  
  use strict;
  use warnings;# FATAL => 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestUtil ();
  
  use Apache::Const -compile => qw(OK DECLINED);
  
  sub handler {
      my $r = shift;
  
      return Apache::DECLINED unless $r->method_number == Apache::M_POST;
  
      my $data = ModPerl::Test::read_post($r);
  
      require Compress::Zlib;
  
      $r->content_type("text/plain");
      $r->content_encoding("gzip");
  
      $r->print(Compress::Zlib::memGzip($data));
  
      Apache::OK;
  }
  
  1;
  __END__
  
  
  

Mime
View raw message