Skip to content

Commit 5a931e2

Browse files
authored
Merge pull request #87 from dakshinai/allow-js_shared_dict_zone
Allow directive js_shared_dict_zone
2 parents c2fcbc0 + b8a4efb commit 5a931e2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

analyze.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,6 +2262,10 @@ var directives = map[string][]uint{
22622262
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
22632263
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake2,
22642264
},
2265+
"js_shared_dict_zone": {
2266+
ngxHTTPMainConf | ngxConf1More,
2267+
ngxStreamMainConf | ngxConf1More,
2268+
},
22652269
"js_var": {
22662270
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake12,
22672271
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake12,

analyze_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,33 @@ func TestAnalyze_njs(t *testing.T) {
261261
blockCtx{"stream"},
262262
true,
263263
},
264+
"js_shared_dict_zone in http context ok": {
265+
&Directive{
266+
Directive: "js_shared_dict_zone",
267+
Args: []string{"zone=foo:1M"},
268+
Line: 5,
269+
},
270+
blockCtx{"http"},
271+
false,
272+
},
273+
"js_shared_dict_zone in stream context ok": {
274+
&Directive{
275+
Directive: "js_shared_dict_zone",
276+
Args: []string{"zone=foo:1M"},
277+
Line: 5,
278+
},
279+
blockCtx{"stream"},
280+
false,
281+
},
282+
"js_shared_dict_zone not ok": {
283+
&Directive{
284+
Directive: "js_shared_dict_zone",
285+
Args: []string{"zone=foo:1M"},
286+
Line: 5,
287+
},
288+
blockCtx{"http", "location"},
289+
true,
290+
},
264291
}
265292

266293
for name, tc := range testcases {

0 commit comments

Comments
 (0)