Mercurial > hg > nginx-tests
annotate subrequest_output_buffer_size.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | 97c8280de681 |
children |
rev | line source |
---|---|
1294
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for subrequest_output_buffer_size directive. |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
15 BEGIN { use FindBin; chdir($FindBin::Bin); } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
16 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
17 use lib 'lib'; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 use Test::Nginx; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 ############################################################################### |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 select STDERR; $| = 1; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 select STDOUT; $| = 1; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 |
1381
97c8280de681
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1295
diff
changeset
|
25 my $t = Test::Nginx->new()->has(qw/http proxy ssi/)->plan(4) |
1294
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 ->write_file_expand('nginx.conf', <<'EOF'); |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 %%TEST_GLOBALS%% |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
29 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
30 daemon off; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 events { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
33 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
35 http { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 %%TEST_GLOBALS_HTTP%% |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 server { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 listen 127.0.0.1:8080; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 server_name localhost; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
41 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 location / { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 proxy_pass http://127.0.0.1:8081; |
1295
22a8982d5de6
Tests: subrequest_output_buffer_size.t adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1294
diff
changeset
|
44 subrequest_output_buffer_size 42; |
1294
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 location /longok { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 proxy_pass http://127.0.0.1:8081/long; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
49 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
50 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 location /ssi { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 ssi on; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
53 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 server { |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 listen 127.0.0.1:8081; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
58 server_name localhost; |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 location / { } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
61 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
62 } |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
63 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
64 EOF |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
65 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
66 $t->write_file('ssi.html', |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
67 '<!--#include virtual="/$arg_c" set="x" -->' . |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 'set: <!--#echo var="x" -->'); |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 $t->write_file('length', 'TEST-OK-IF-YOU-SEE-THIS'); |
1295
22a8982d5de6
Tests: subrequest_output_buffer_size.t adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1294
diff
changeset
|
71 $t->write_file('long', 'x' x 400); |
1294
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 $t->write_file('empty', ''); |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 |
1381
97c8280de681
Tests: removed TODO and try_run() checks for legacy versions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1295
diff
changeset
|
74 $t->run(); |
1294
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 ############################################################################### |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 my ($r, $n); |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
80 like(http_get('/ssi.html?c=length'), qr/SEE-THIS/, 'request'); |
1295
22a8982d5de6
Tests: subrequest_output_buffer_size.t adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1294
diff
changeset
|
81 like(http_get('/ssi.html?c=empty'), qr/set: $/, 'empty'); |
22a8982d5de6
Tests: subrequest_output_buffer_size.t adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1294
diff
changeset
|
82 unlike(http_get('/ssi.html?c=long'), qr/200 OK/, 'long'); |
22a8982d5de6
Tests: subrequest_output_buffer_size.t adjusted.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1294
diff
changeset
|
83 like(http_get('/ssi.html?c=longok'), qr/x{400}/, 'long ok'); |
1294
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 |
192a44f590a9
Tests: subrequest_output_buffer_size directive tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 ############################################################################### |