File: 060.slow_post.t

package info (click to toggle)
libcgi-simple-perl 1.282-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 604 kB
  • sloc: perl: 1,885; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 787 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use strict;
use warnings;
use Test::More tests => 2;
use Config;

use CGI::Simple;

# Makes forked test work OK
Test::More->builder->no_ending( 1 );

my ( $q, $sv );

$CGI::Simple::POST_MAX = -1;

SKIP: {
  skip "Fork not available on this platform", 2
   unless $Config{d_fork};

  $ENV{REQUEST_METHOD} = 'POST';
  $ENV{CONTENT_LENGTH} = 10_005;
  $ENV{CONTENT_TYPE}   = 'application/x-www-form-urlencoded';

  if ( open( CHILD, "|-" ) ) {    # cparent
    print CHILD 'SLOW=';
    for ( 1 .. 10 ) {
      print CHILD 'X' x 1000;
      sleep 1;
    }
    close CHILD;
    exit 0;
  }

  # at this point, we're in a new (child) process
  $q  = CGI::Simple->new;
  $sv = $q->param( 'SLOW' );

  is( length $sv, 10_000,       'length ok' );
  is( $sv,        'X' x 10_000, 'value ok' );
}