annotate proxy_cache_valid.t @ 1961:fe6f22da53ec default tip

Tests: tests for usage of discarded body. The client_max_body_size limit should be ignored when the request body is already discarded. In HTTP/1.x, this is done by checking the r->discard_body flag when the body is being discarded, and because r->headers_in.content_length_n is 0 when it's already discarded. This, however, does not happen with HTTP/2 and HTTP/3, and therefore "error_page 413" does not work without relaxing the limit. Further, with proxy_pass, r->headers_in.content_length_n is used to determine length of the request body, and therefore is not correct if discarding of the request body isn't yet complete. While discarding the request body, r->headers_in.content_length_n contains the rest of the body to discard (or, in case of chunked request body, the rest of the current chunk to discard). Similarly, the $content_length variable uses r->headers_in.content_length if available, and also incorrect. The $content_length variable is used when proxying with fastcgi_pass, grpc_pass, and uwsgi_pass (scgi_pass uses the value calculated based on the actual request body buffers, and therefore works correctly).
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:55:50 +0300
parents 97c8280de681
children
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 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 ###############################################################################