httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-test/perl-framework/t/apache contentlength.t
Date Mon, 17 Jun 2002 23:09:16 GMT
jerenkrantz    2002/06/17 16:09:16

  Added:       perl-framework/t/apache contentlength.t
  Log:
  Add boundary tests for C-L header parsing cases.
  
  Revision  Changes    Path
  1.1                  httpd-test/perl-framework/t/apache/contentlength.t
  
  Index: contentlength.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  use Apache::TestRequest ();
  
  my @test_strings = ("",
                      "0",
                      "0000000000000000000000000000000000",
                      "1000000000000000000000000000000000",
                      "-1",
                      );
  my @req_strings =  ("/echo_post",
                      "/i_do_not_exist_in_your_wildest_imagination");
  
  # This is expanded out.
  my @resp_strings = ("HTTP/1.1 200 OK",
                      "HTTP/1.1 404 Not Found",
                      "HTTP/1.1 200 OK",
                      "HTTP/1.1 404 Not Found",
                      "HTTP/1.1 200 OK",
                      "HTTP/1.1 404 Not Found",
                      "HTTP/1.1 413 Request Entity Too Large",
                      "HTTP/1.1 413 Request Entity Too Large",
                      "HTTP/1.1 413 Request Entity Too Large",
                      "HTTP/1.1 413 Request Entity Too Large",
                     );
  
  my $tests = 4 * @test_strings;
  my $vars = Apache::Test::vars();
  my $module = 'default';
  my $cycle = 0;
  
  plan tests => $tests;
  
  print "testing $module\n";
  
  for my $data (@test_strings) {
    for my $request_uri (@req_strings) {
      my $sock = Apache::TestRequest::vhost_socket($module);
      ok $sock;
  
      Apache::TestRequest::socket_trace($sock);
  
      $sock->print("POST $request_uri HTTP/1.0\n");
      $sock->print("Content-Length: $data\n");
      $sock->print("\n");
      $sock->print("\n");
  
      # Read the status line
      chomp(my $response = Apache::TestRequest::getline($sock));
      $response =~ s/\s$//;
      ok t_cmp($resp_strings[$cycle++], $response, "response codes");
  
      do {
          chomp($response = Apache::TestRequest::getline($sock));
          $response =~ s/\s$//;
      }
      while ($response ne "");
    }
  }
  
  
  

Mime
View raw message