summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/ssl/pr12355.t
blob: 51be00fc860b9fafb4d6baba4cc9d87dee994de1 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use strict;
use warnings FATAL => 'all';

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

plan tests => 10, need 'ssl', need_min_apache_version('2.0');

Apache::TestRequest::user_agent( ssl_opts => { SSL_cipher_list => 'ALL'});
Apache::TestRequest::user_agent_keepalive(1);
Apache::TestRequest::scheme('https');

my $r;

# Send a series of POST requests with varying size request bodies.
# Alternate between the location which requires a AES128-SHA ciphersuite
# and one which requires AES256-SHA; mod_ssl will attempt to perform the
# renegotiation between each request, and hence needs to perform the
# buffering of request body data.

$r = POST "/require-aes256-cgi/perl_echo.pl", content => "hello world";

ok t_cmp($r->code, 200, "renegotiation on POST works");
ok t_cmp($r->content, "hello world", "request body matches response");

$r = POST "/require-aes128-cgi/perl_echo.pl", content => "hello world";

ok t_cmp($r->code, 200, "renegotiation on POST works");
ok t_cmp($r->content, "hello world", "request body matches response");

$r = POST "/require-aes256-cgi/perl_echo.pl", content => 'x'x10000;

ok t_cmp($r->code, 200, "renegotiation on POST works");
ok t_cmp($r->content, $r->request->content, "request body matches response");

$r = POST "/require-aes128-cgi/perl_echo.pl", content => 'x'x60000;

ok t_cmp($r->code, 200, "renegotiation on POST works");
ok t_cmp($r->content, $r->request->content, "request body matches response");

# Test that content-level input filters are still run as expected by
# using a request which triggers the mod_case_filter_in:

my @filter = ('X-AddInputFilter' => 'CaseFilterIn'); #mod_client_add_filter

if (have_module('case_filter_in')) {
    $r = POST "/require-aes256-cgi/perl_echo.pl", @filter, content => "hello";
    
    ok t_cmp($r->code, 200, "renegotiation on POST works");
    ok t_cmp($r->content, "HELLO", "request body matches response");
} else {
    skip "mod_case_filter_in not available" foreach (1..2);
}