Skip to content

Commit 8c45ad1

Browse files
committed
fix(*) proper filter modules order in dynamic OpenResty builds
Without this fix, the wasm_filter_module handlers execute before `body_filter_by_lua`, which isn't the desired behavior (i.e. same as static builds). This patch fixes FFI getter/setter `body_filter_by_lua` sanity tests, which were caught thanks to proper use of `--- grep_error_log`.
1 parent 33157a8 commit 8c45ad1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/wasm/ngx_wasm_core_module.c

+11
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,17 @@ ngx_wasm_core_create_conf(ngx_conf_t *cf)
332332
* 2. ngx_http_lua_module
333333
*/
334334
swap_modules_if_needed(cf, "ngx_http_lua_module", "ngx_wasm_core_module");
335+
336+
/**
337+
* ngx_http_lua_module filter is expected to run before ngx_wasm_filter in
338+
* the test suite (filters run in reverse order).
339+
*
340+
* Mimic static cycle order if necessary:
341+
* 1. ngx_http_lua_module (filter)
342+
* 2. ngx_http_wasm_filter_module
343+
*/
344+
swap_modules_if_needed(cf, "ngx_http_lua_module",
345+
"ngx_http_wasm_filter_module");
335346
#endif
336347

337348
wcf = ngx_pcalloc(cycle->pool, sizeof(ngx_wasm_core_conf_t));

0 commit comments

Comments
 (0)