comparison ssi-include-big.t @ 15:c6c36d7a4d90

Tests: support config embedded in test itself.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 13 Sep 2008 02:57:01 +0400
parents d4b74207a627
children b331c3113ebb
comparison
equal deleted inserted replaced
14:d4b74207a627 15:c6c36d7a4d90
19 ############################################################################### 19 ###############################################################################
20 20
21 select STDERR; $| = 1; 21 select STDERR; $| = 1;
22 select STDOUT; $| = 1; 22 select STDOUT; $| = 1;
23 23
24 my $t = Test::Nginx->new()->run('ssi-include-big.conf'); 24 my $t = Test::Nginx->new();
25
26 $t->write_file_expand('nginx.conf', <<'EOF');
27
28 master_process off;
29 daemon off;
30
31 events {
32 worker_connections 1024;
33 }
34
35 http {
36 access_log off;
37 root %%TESTDIR%%;
38
39 output_buffers 2 512;
40 ssi on;
41 gzip on;
42
43 server {
44 listen localhost:8080;
45 server_name localhost;
46
47 location /proxy/ {
48 proxy_pass http://localhost:8080/local/;
49 }
50 location = /local/blah {
51 return 204;
52 }
53 }
54 }
55
56 EOF
25 57
26 $t->write_file('c1.html', 'X' x 1023); 58 $t->write_file('c1.html', 'X' x 1023);
27 $t->write_file('c2.html', 'X' x 1024); 59 $t->write_file('c2.html', 'X' x 1024);
28 $t->write_file('c3.html', 'X' x 1025); 60 $t->write_file('c3.html', 'X' x 1025);
29 $t->write_file('test1.html', '<!--#include virtual="/proxy/blah" -->' . "\n" 61 $t->write_file('test1.html', '<!--#include virtual="/proxy/blah" -->' . "\n"
30 . '<!--#include virtual="/c1.html" -->'); 62 . '<!--#include virtual="/c1.html" -->');
31 $t->write_file('test2.html', '<!--#include virtual="/proxy/blah" -->' . "\n" 63 $t->write_file('test2.html', '<!--#include virtual="/proxy/blah" -->' . "\n"
32 . '<!--#include virtual="/c2.html" -->'); 64 . '<!--#include virtual="/c2.html" -->');
33 $t->write_file('test3.html', '<!--#include virtual="/proxy/blah" -->' . "\n" 65 $t->write_file('test3.html', '<!--#include virtual="/proxy/blah" -->' . "\n"
34 . '<!--#include virtual="/c3.html" -->'); 66 . '<!--#include virtual="/c3.html" -->');
67
68 $t->run();
35 69
36 ############################################################################### 70 ###############################################################################
37 71
38 my $t1 = http_gzip_request('/test1.html'); 72 my $t1 = http_gzip_request('/test1.html');
39 ok(defined $t1, 'small included file (less than output_buffers)'); 73 ok(defined $t1, 'small included file (less than output_buffers)');
47 ############################################################################### 81 ###############################################################################
48 82
49 sub http_gzip_request { 83 sub http_gzip_request {
50 my ($url) = @_; 84 my ($url) = @_;
51 my $r = http(<<EOF); 85 my $r = http(<<EOF);
52 GET $url HTTP/1.0 86 GET $url HTTP/1.1
53 Host: localhost 87 Host: localhost
54 Connection: close 88 Connection: close
55 Accept-Encoding: gzip 89 Accept-Encoding: gzip
56 90
57 EOF 91 EOF