File tree Expand file tree Collapse file tree 6 files changed +137
-2
lines changed Expand file tree Collapse file tree 6 files changed +137
-2
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ ngx_http_srcache_access_handler(ngx_http_request_t *r)
174
174
cl = ngx_alloc_chain_link (r -> pool );
175
175
cl -> buf = ngx_calloc_buf (r -> pool );
176
176
cl -> buf -> last_buf = 1 ;
177
+ cl -> next = NULL ;
177
178
178
179
rc = ngx_http_srcache_next_body_filter (r , cl );
179
180
@@ -215,6 +216,7 @@ ngx_http_srcache_access_handler(ngx_http_request_t *r)
215
216
216
217
ph = cmcf -> phase_engine .handlers ;
217
218
cur_ph = & ph [r -> phase_handler ];
219
+
218
220
last_ph = & ph [cur_ph -> next - 1 ];
219
221
220
222
if (cur_ph < last_ph ) {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use Test::Nginx::Socket;
5
5
6
6
# repeat_each(2);
7
7
8
- plan tests => repeat_each() * 4 * blocks();
8
+ plan tests => repeat_each() * ( 4 * blocks() + 1 );
9
9
10
10
$ENV {TEST_NGINX_MEMCACHED_PORT } ||= 11211;
11
11
@@ -194,6 +194,8 @@ HEAD /foo
194
194
Content-Type: text/css
195
195
Content-Length: 0
196
196
--- response_body
197
+ --- no_error_log
198
+ [error]
197
199
198
200
199
201
Original file line number Diff line number Diff line change
1
+ # vi:filetype=
2
+
3
+ use lib ' lib' ;
4
+ use Test::Nginx::Socket;
5
+
6
+ # repeat_each(2);
7
+
8
+ plan tests => repeat_each() * (3 * blocks() + 2);
9
+
10
+ $ENV {TEST_NGINX_MEMCACHED_PORT } ||= 11211;
11
+
12
+ # master_on();
13
+ no_shuffle();
14
+
15
+ run_tests();
16
+
17
+ __DATA__
18
+
19
+ === TEST 1: flush all
20
+ --- config
21
+ location /flush {
22
+ set $memc_cmd 'flush_all';
23
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
24
+ }
25
+ --- response_headers
26
+ Content-Type: text/plain
27
+ Content-Length: 4
28
+ --- request
29
+ GET /flush
30
+ --- response_body eval: "OK\r\n"
31
+
32
+
33
+
34
+ === TEST 2: basic fetch (cache miss) - deny all
35
+ --- config
36
+ location /foo {
37
+ satisfy any;
38
+
39
+ deny all;
40
+
41
+ default_type text/css;
42
+ srcache_fetch GET /memc $uri;
43
+ srcache_store PUT /memc $uri;
44
+
45
+ echo hello;
46
+ }
47
+
48
+ location /memc {
49
+ internal;
50
+
51
+ set $memc_key $query_string;
52
+ set $memc_exptime 300;
53
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
54
+ }
55
+ --- request
56
+ GET /foo
57
+ --- response_headers
58
+ --- response_body_like: 403 Forbidden
59
+ --- error_code: 403
60
+
61
+
62
+
63
+ === TEST 3: basic fetch (cache miss)
64
+ --- config
65
+ location /foo {
66
+ satisfy any;
67
+
68
+ default_type text/css;
69
+ srcache_fetch GET /memc $uri;
70
+ srcache_store PUT /memc $uri;
71
+
72
+ echo hello;
73
+ }
74
+
75
+ location /memc {
76
+ internal;
77
+
78
+ set $memc_key $query_string;
79
+ set $memc_exptime 300;
80
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
81
+ }
82
+ --- request
83
+ GET /foo
84
+ --- response_headers
85
+ Content-Type: text/css
86
+ Content-Length:
87
+ --- response_body
88
+ hello
89
+
90
+
91
+
92
+ === TEST 4: basic fetch (cache hit)
93
+ --- config
94
+ location /foo {
95
+ satisfy any;
96
+
97
+ default_type text/css;
98
+
99
+ srcache_fetch GET /memc $uri;
100
+ srcache_store PUT /memc $uri;
101
+
102
+ echo world;
103
+ }
104
+
105
+ location /memc {
106
+ internal;
107
+
108
+ set $memc_key $query_string;
109
+ set $memc_exptime 300;
110
+ memc_pass 127.0.0.1:$TEST_NGINX_MEMCACHED_PORT;
111
+ }
112
+ --- request
113
+ GET /foo
114
+ --- response_headers
115
+ Content-Type: text/css
116
+ Content-Length: 6
117
+ --- response_body
118
+ hello
119
+
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ run_tests();
16
16
17
17
__DATA__
18
18
19
- === TEST 2 : basic fetch (cache miss)
19
+ === TEST 1 : basic fetch (cache miss)
20
20
--- config
21
21
error_page 500 502 503 504 /50x.html;
22
22
location = /50x.html {
Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ ngx-build $force $version \
31
31
--add-module=$root /../postgres-nginx-module \
32
32
--add-module=$root /../memc-nginx-module \
33
33
--add-module=$root /../ndk-nginx-module \
34
+ --with-select_module \
35
+ --with-poll_module \
36
+ --with-rtsig_module \
34
37
--with-debug
35
38
# --add-module=/home/agentz/git/dodo/utils/dodo-hook \
36
39
# --add-module=$home/work/ngx_http_auth_request-0.1 #\
Original file line number Diff line number Diff line change
1
+ {
2
+ <insert_a_suppression_name_here>
3
+ Memcheck:Leak
4
+ fun:malloc
5
+ fun:ngx_calloc
6
+ fun:ngx_event_process_init
7
+ fun:ngx_single_process_cycle
8
+ fun:main
9
+ }
1
10
{
2
11
<insert_a_suppression_name_here>
3
12
exp-sgcheck:SorG
You can’t perform that action at this time.
0 commit comments