Skip to content

Commit

Permalink
fix(*) proper filter modules order in dynamic OpenResty builds
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
thibaultcha committed Nov 26, 2023
1 parent b09edab commit d77a18b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/wasm/ngx_wasm_core_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,17 @@ ngx_wasm_core_create_conf(ngx_conf_t *cf)
* 2. ngx_http_lua_module
*/
swap_modules_if_needed(cf, "ngx_http_lua_module", "ngx_wasm_core_module");

/**
* ngx_http_lua_module filter is expected to run before ngx_wasm_filter in
* the test suite (filters run in reverse order).
*
* Mimic static cycle order if necessary:
* 1. ngx_http_wasm_filter_module
* 2. ngx_http_lua_module
*/
swap_modules_if_needed(cf, "ngx_http_lua_module",
"ngx_http_wasm_filter_module");
#endif

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

0 comments on commit d77a18b

Please sign in to comment.