annotate proxy_cache_valid.t @ 1236:93f749c1d5c5

Tests: fixed parallel tests execution with UDP. Previously, when checking ports availability, a UDP socket was always created first, then a TCP socket was created. On success, one of UDP and TCP sockets was closed (depending on the "udp" option) and the second one was used to busy this port in other scripts. This lead to the following problem: in an attempt to reopen a UDP socket used in a given testing script it could be stolen by another script as part of checking ports availability. To solve this problem, UDP and TCP ports were split into two non-overlapping ranges: TCP ports are only used in the range 8000-8499, and UDP ports - in the range 8500-8999. In addition, the order of creating sockets in UDP tests has been reversed: now a TCP socket used as a lock precedes a UDP socket.
author Andrey Zelenkov <zelenkov@nginx.com>
date Thu, 26 Oct 2017 18:00:21 +0300
parents 66426ca24671
children 97c8280de681
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
2
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
3 # (C) Sergey Kandaurov
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
4 # (C) Nginx, Inc.
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
5
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
6 # Tests for http proxy cache, the proxy_cache_valid directive
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
7 # used with the caching parameters set in the response header.
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
8
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
9 ###############################################################################
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
10
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
11 use warnings;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
12 use strict;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
13
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
14 use Test::More;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
15
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
16 BEGIN { use FindBin; chdir($FindBin::Bin); }
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
17
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
18 use lib 'lib';
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
19 use Test::Nginx;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
20
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
21 ###############################################################################
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
22
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
23 select STDERR; $| = 1;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
24 select STDOUT; $| = 1;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
25
1225
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
26 my $t = Test::Nginx->new()->has(qw/http proxy cache rewrite/)->plan(12)
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
27 ->write_file_expand('nginx.conf', <<'EOF');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
28
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
29 %%TEST_GLOBALS%%
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
30
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
31 daemon off;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
32
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
33 events {
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
34 }
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
35
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
36 http {
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
37 %%TEST_GLOBALS_HTTP%%
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
38
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
39 proxy_cache_path %%TESTDIR%%/cache levels=1:2
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
40 keys_zone=NAME:1m;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
41
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
42 server {
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
43 listen 127.0.0.1:8080;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
44 server_name localhost;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
45
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
46 location / {
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
47 proxy_pass http://127.0.0.1:8081;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
48 proxy_cache NAME;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
49
1225
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
50 proxy_cache_valid 200 401 1m;
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
51
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
52 proxy_intercept_errors on;
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
53 error_page 404 401 = @fallback;
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
54
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
55 add_header X-Cache-Status $upstream_cache_status;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
56 }
1225
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
57
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
58 location @fallback {
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
59 return 403;
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
60 }
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
61 }
1225
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
62
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
63 server {
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
64 listen 127.0.0.1:8081;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
65 server_name localhost;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
66
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
67 location / {
1225
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
68 add_header Cache-Control $http_x_cc always;
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
69 error_page 403 = /index-no-cache;
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
70 }
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
71
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
72 location /index-no-cache {
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
73 add_header Cache-Control no-cache always;
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
74 return 401;
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
75 }
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
76 }
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
77 }
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
78
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
79 EOF
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
80
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
81 $t->write_file('t.html', 'SEE-THIS');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
82 $t->run();
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
83
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
84 ###############################################################################
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
85
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
86 like(get('/t.html?1', 'X-CC: max-age=1'), qr/MISS/, 'max-age');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
87 like(get('/t.html?2', 'X-CC: max-age=1, s-maxage=10'), qr/MISS/, 's-maxage');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
88 like(http_get('/t.html?3'), qr/MISS/, 'proxy_cache_valid');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
89
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
90 $t->write_file('t.html', 'NOOP');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
91
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
92 like(http_get('/t.html?1'), qr/HIT/, 'max-age cached');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
93 like(http_get('/t.html?2'), qr/HIT/, 's-maxage cached');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
94 like(http_get('/t.html?3'), qr/HIT/, 'proxy_cache_valid cached');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
95
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
96 select undef, undef, undef, 2.1;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
97
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
98 # Cache-Control in the response header overrides proxy_cache_valid
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
99
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
100 like(http_get('/t.html?1'), qr/EXPIRED/, 'max-age ceased');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
101 like(http_get('/t.html?2'), qr/HIT/, 's-maxage overrides max-age');
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
102
1225
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
103 # ticket #1382, cache item "error" field was not set from Cache-Control: max-age
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
104
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
105 like(get('/t2.html', 'X-CC: max-age=1'), qr/403 Forbidden/, 'intercept error');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
106
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
107 $t->write_file('t2.html', 'NOOP');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
108
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
109 TODO: {
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
110 local $TODO = 'not yet' unless $t->has_version('1.13.6');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
111
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
112 like(http_get('/t2.html'), qr/403 Forbidden/, 'error cached from max-age');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
113
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
114 }
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
115
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
116 # ticket #1382, cache item "error" field was set regardless of u->cacheable.
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
117
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
118 like(http_get('/'), qr/403 Forbidden/, 'error no-cache');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
119
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
120 $t->write_file('index.html', '');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
121
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
122 TODO: {
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
123 local $TODO = 'not yet' unless $t->has_version('1.13.6');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
124
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
125 like(http_get('/'), qr/200 OK/, 'error no-cache - not cacheable');
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
126
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
127 }
66426ca24671 Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents: 1163
diff changeset
128
1163
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
129 ###############################################################################
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
130
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
131 sub get {
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
132 my ($url, $extra) = @_;
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
133 return http(<<EOF);
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
134 GET $url HTTP/1.1
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
135 Host: localhost
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
136 Connection: close
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
137 $extra
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
138
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
139 EOF
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
140 }
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
141
bd1cf0a80b28 Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff changeset
142 ###############################################################################