Skip to content

Commit 2c40455

Browse files
committed
bugfix: we lacked detailed context info in error messages due to use of disabled Lua APIs in body_filter_by_lua*. thanks Dejiang Zhu for the patch in openresty#623.
1 parent 9789058 commit 2c40455

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/ngx_http_lua_util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ extern char ngx_http_lua_headers_metatable_key;
8282
: (c) == NGX_HTTP_LUA_CONTEXT_CONTENT ? "content_by_lua*" \
8383
: (c) == NGX_HTTP_LUA_CONTEXT_LOG ? "log_by_lua*" \
8484
: (c) == NGX_HTTP_LUA_CONTEXT_HEADER_FILTER ? "header_filter_by_lua*" \
85+
: (c) == NGX_HTTP_LUA_CONTEXT_BODY_FILTER ? "body_filter_by_lua*" \
8586
: (c) == NGX_HTTP_LUA_CONTEXT_TIMER ? "ngx.timer" \
8687
: (c) == NGX_HTTP_LUA_CONTEXT_INIT_WORKER ? "init_worker_by_lua*" \
8788
: "(unknown)")

t/082-body-filter.t

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ log_level('debug');
1010

1111
repeat_each(2);
1212

13-
plan tests => repeat_each() * (blocks() * 3 + 13);
13+
plan tests => repeat_each() * (blocks() * 3 + 11);
1414

1515
#no_diff();
1616
no_long_string();
@@ -824,3 +824,16 @@ eof 2: true
824824
[error]
825825
[alert]
826826
827+
828+
829+
=== TEST 26: no ngx.print
830+
--- config
831+
location /lua {
832+
echo ok;
833+
body_filter_by_lua "ngx.print(32) return 1";
834+
}
835+
--- request
836+
GET /lua
837+
--- ignore_response
838+
--- error_log
839+
API disabled in the context of body_filter_by_lua*

0 commit comments

Comments
 (0)