Mercurial > hg > nginx-tests
annotate proxy_duplicate_headers.t @ 1990:85d88cd5091c
Tests: SSI include stub tests.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 04 Jul 2024 17:42:55 +0300 |
parents | a095b971fbcc |
children |
rev | line source |
---|---|
1769
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
2 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
3 # (C) Maxim Dounin |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
4 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
5 # Test for http backend returning response with invalid and duplicate |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
6 # headers. |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
7 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
8 ############################################################################### |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
9 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
10 use warnings; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
11 use strict; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
12 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
13 use Test::More; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
14 use Socket qw/ CRLF /; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
15 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
16 BEGIN { use FindBin; chdir($FindBin::Bin); } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
17 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
18 use lib 'lib'; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
19 use Test::Nginx; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
20 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
21 ############################################################################### |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
22 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
23 select STDERR; $| = 1; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
24 select STDOUT; $| = 1; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
25 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
26 my $t = Test::Nginx->new()->has(qw/http proxy/)->plan(8); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
27 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
28 $t->write_file_expand('nginx.conf', <<'EOF'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
29 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
30 %%TEST_GLOBALS%% |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
31 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
32 daemon off; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
33 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
34 events { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
35 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
36 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
37 http { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
38 %%TEST_GLOBALS_HTTP%% |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
39 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
40 server { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
41 listen 127.0.0.1:8080; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
42 server_name localhost; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
43 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
44 location / { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
45 proxy_pass http://127.0.0.1:8081; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
46 proxy_read_timeout 1s; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
47 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
48 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
49 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
50 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
51 EOF |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
52 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
53 $t->run_daemon(\&http_daemon); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
54 $t->run()->waitforsocket('127.0.0.1:' . port(8081)); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
55 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
56 ############################################################################### |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
57 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
58 like(http_get('/'), qr/200 OK/, 'normal'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
59 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
60 like(http_get('/invalid-length'), qr/502 Bad/, 'invalid length'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
61 like(http_get('/duplicate-length'), qr/502 Bad/, 'duplicate length'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
62 like(http_get('/unknown-transfer-encoding'), qr/502 Bad/, |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
63 'unknown transfer encoding'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
64 like(http_get('/duplicate-transfer-encoding'), qr/502 Bad/, |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
65 'duplicate transfer encoding'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
66 like(http_get('/length-and-transfer-encoding'), qr/502 Bad/, |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
67 'length and transfer encoding'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
68 like(http_get('/transfer-encoding-and-length'), qr/502 Bad/, |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
69 'transfer encoding and length'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
70 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
71 like(http_get('/duplicate-expires'), qr/Expires: foo(?!.*bar)/s, |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
72 'duplicate expires ignored'); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
73 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
74 ############################################################################### |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
75 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
76 sub http_daemon { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
77 my $server = IO::Socket::INET->new( |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
78 Proto => 'tcp', |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
79 LocalAddr => '127.0.0.1:' . port(8081), |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
80 Listen => 5, |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
81 Reuse => 1 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
82 ) |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
83 or die "Can't create listening socket: $!\n"; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
84 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
85 local $SIG{PIPE} = 'IGNORE'; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
86 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
87 while (my $client = $server->accept()) { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
88 $client->autoflush(1); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
89 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
90 my $headers = ''; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
91 my $uri = ''; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
92 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
93 while (<$client>) { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
94 $headers .= $_; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
95 last if (/^\x0d?\x0a?$/); |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
96 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
97 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
98 $uri = $1 if $headers =~ /^\S+\s+([^ ]+)\s+HTTP/i; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
99 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
100 if ($uri eq '/') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
101 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
102 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
103 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
104 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
105 'Content-Length: 0' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
106 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
107 } elsif ($uri eq '/invalid-length') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
108 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
109 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
110 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
111 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
112 'Content-Length: foo' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
113 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
114 } elsif ($uri eq '/duplicate-length') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
115 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
116 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
117 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
118 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
119 'Content-Length: 0' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
120 'Content-Length: 0' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
121 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
122 } elsif ($uri eq '/unknown-transfer-encoding') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
123 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
124 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
125 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
126 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
127 'Transfer-Encoding: foo' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
128 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
129 } elsif ($uri eq '/duplicate-transfer-encoding') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
130 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
131 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
132 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
133 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
134 'Transfer-Encoding: chunked' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
135 'Transfer-Encoding: chunked' . CRLF . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
136 '0' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
137 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
138 } elsif ($uri eq '/length-and-transfer-encoding') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
139 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
140 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
141 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
142 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
143 'Content-Length: 0' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
144 'Transfer-Encoding: chunked' . CRLF . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
145 '0' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
146 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
147 } elsif ($uri eq '/transfer-encoding-and-length') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
148 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
149 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
150 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
151 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
152 'Transfer-Encoding: chunked' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
153 'Content-Length: 0' . CRLF . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
154 '0' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
155 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
156 } elsif ($uri eq '/duplicate-expires') { |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
157 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
158 print $client |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
159 'HTTP/1.1 200 OK' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
160 'Connection: close' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
161 'Expires: foo' . CRLF . |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
162 'Expires: bar' . CRLF . CRLF; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
163 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
164 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
165 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
166 close $client; |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
167 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
168 } |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
169 |
735226e4c7fe
Tests: tests for duplicate response headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
diff
changeset
|
170 ############################################################################### |