Mercurial > hg > nginx-tests
annotate proxy_cache_valid.t @ 1571:1b4ceab9cb1c
Tests: fixed ssl_certificate.t with LibreSSL client.
Net::SSLeay::connect() that manages TLS handshake could return unexpected
error when receiving server alert, as seen in server certificate tests if
it could not been selected. Typically, it returns the expected error -1,
but with certain libssl implementations it can be 0, as explained below.
The error is propagated from libssl's SSL_connect(), which is usually -1.
In modern OpenSSL versions, it is the default error code used in the state
machine returned when something went wrong with parsing TLS message header.
In versions up to OpenSSL 1.0.2, with SSLv23_method() used by default, -1
is the only error code in the ssl_connect() method implementation which is
used as well if receiving alert while parsing ServerHello. BoringSSL also
seems to return -1. But it is not so with LibreSSL that returns zero.
Previously, tests failed with client built with LibreSSL with SSLv3 removed.
Here, the error is propagated directly from ssl_read_bytes() method, which
is always implemented as ssl3_read_bytes() in all TLS methods. It could be
also seen with OpenSSL up to 1.0.2 with non-default methods explicitly set.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Fri, 29 May 2020 23:10:20 +0300 |
parents | 97c8280de681 |
children |
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 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
|
110 |
66426ca24671
Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1163
diff
changeset
|
111 # 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
|
112 |
66426ca24671
Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1163
diff
changeset
|
113 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
|
114 |
66426ca24671
Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1163
diff
changeset
|
115 $t->write_file('index.html', ''); |
66426ca24671
Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1163
diff
changeset
|
116 |
66426ca24671
Tests: intercepted errors with cache control (ticket #1382).
Sergey Kandaurov <pluknet@nginx.com>
parents:
1163
diff
changeset
|
117 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
|
118 |
1163
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 ############################################################################### |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 sub get { |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 my ($url, $extra) = @_; |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 return http(<<EOF); |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 GET $url HTTP/1.1 |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 Host: localhost |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 Connection: close |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 $extra |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 EOF |
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 |
bd1cf0a80b28
Tests: Cache-Control max-age/s-maxage set in response.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 ############################################################################### |