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 2002/08/15 15:11:06 UTC

cvs commit: modperl-2.0/t/response/TestAPI send_fd.pm

stas        2002/08/15 06:11:06

  Added:       t/compat send_fd.t
               t/response/TestCompat send_fd.pm
  Removed:     t/api    send_fd.t
               t/response/TestAPI send_fd.pm
  Log:
  send_fd exists only in compat, move that test into compat/
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/compat/send_fd.t
  
  Index: send_fd.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  
  plan tests => 3;
  
  my $config = Apache::Test::config();
  
  my $url = '/TestCompat::send_fd';
  
  my $data = GET_BODY($url);
  
  ok $data;
  
  my $module = 'response/TestCompat/send_fd.pm';
  
  ok length($data) == -s $module;
  
  $data = GET_BODY("$url?noexist.txt");
  
  ok $data =~ /Not Found/;
  
  
  
  1.1                  modperl-2.0/t/response/TestCompat/send_fd.pm
  
  Index: send_fd.pm
  ===================================================================
  package TestCompat::send_fd;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::compat ();
  use Apache::RequestRec ();
  
  use Apache::Const -compile => ':common';
  
  sub handler {
      my $r = shift;
  
      my $file = $r->args || __FILE__;
  
      open my $fh, $file or return Apache::NOT_FOUND;
  
      my $bytes = $r->send_fd($fh);
  
      return Apache::SERVER_ERROR unless $bytes == -s $file;
  
      Apache::OK;
  }
  
  1;