File: buffer.t

package info (click to toggle)
apache2 2.4.66-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 59,324 kB
  • sloc: ansic: 212,315; python: 13,830; perl: 11,307; sh: 7,254; php: 1,320; javascript: 1,314; awk: 749; makefile: 715; lex: 374; yacc: 161; xml: 2
file content (38 lines) | stat: -rw-r--r-- 1,163 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
use strict;
use warnings FATAL => 'all';

use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest;

my @testcases = (
    ['/apache/buffer_in/', 'foo'],
    ['/apache/buffer_out/', 'foo'],
    ['/apache/buffer_in_out/', 'foo'],
);

plan tests => scalar @testcases * 4, need 'mod_reflector', 'mod_buffer';

foreach my $t (@testcases) {
    ## Small query ##
    my $r = POST($t->[0], content => $t->[1]);

    # Checking for return code
    ok t_cmp($r->code, 200, "Checking return code is '200'");
    # Checking for content
    ok t_is_equal($r->content, $t->[1]);
    
    ## Big query ##
    # 'foo' is 3 bytes, so 'foo' x 1000000 is ~3M, which is way over the default 'BufferSize'
    ### FIXME - testing with to x 10000 is confusing LWP's full-duplex
    ### handling: https://github.com/libwww-perl/libwww-perl/issues/299
    ### throttled down to a size which seems to work reliably for now
    my $bigsize = 100000;

    $r = POST($t->[0], content => $t->[1] x $bigsize);

    # Checking for return code
    ok t_cmp($r->code, 200, "Checking return code is '200'");
    # Checking for content
    ok t_is_equal($r->content, $t->[1] x $bigsize);
}