Skip to content

Commit 098aace

Browse files
committed
rename body_exited to body_filter_aborted
1 parent aefc821 commit 098aace

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/ngx_http_lua_bodyfilterby.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ ngx_http_lua_body_filter_by_chunk(lua_State *L, ngx_http_request_t *r,
146146

147147
lua_settop(L, 0);
148148

149-
if (ctx->body_exited) {
149+
if (ctx->body_filter_aborted) {
150150
/* send last content */
151151
for (cl = in; cl->next; cl = cl->next) {
152152
/* do nothing */
@@ -271,7 +271,7 @@ ngx_http_lua_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
271271
}
272272
}
273273

274-
if (ctx->body_exited) {
274+
if (ctx->body_filter_aborted) {
275275
return NGX_ERROR;
276276
}
277277

src/ngx_http_lua_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ typedef struct ngx_http_lua_ctx_s {
487487

488488
unsigned exited:1;
489489

490-
unsigned body_exited:1;
490+
unsigned body_filter_aborted:1;
491491

492492
unsigned eof:1; /* 1: last_buf has been sent;
493493
0: last_buf not sent yet */

src/ngx_http_lua_control.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,12 @@ ngx_http_lua_ngx_exit(lua_State *L)
329329

330330
if (ctx->context & NGX_HTTP_LUA_CONTEXT_BODY_FILTER) {
331331

332-
if (rc != NGX_ERROR && rc < 400) {
333-
return luaL_error(L, "attempt to exit with the code smaller "
334-
"than 400 and not ngx.ERROR");
332+
if (rc != NGX_ERROR && rc != NGX_HTTP_CLOSE) {
333+
return luaL_error(L, "attempt to exit with the code not 444 "
334+
"or ngx.ERROR");
335335
}
336336

337-
ctx->body_exited = 1;
337+
ctx->body_filter_aborted = 1;
338338
ctx->exit_code = rc;
339339
ctx->exited = 1;
340340
return 0;
@@ -497,14 +497,14 @@ ngx_http_lua_ffi_exit(ngx_http_request_t *r, int status, u_char *err,
497497

498498
if (ctx->context & NGX_HTTP_LUA_CONTEXT_BODY_FILTER) {
499499

500-
if (status != NGX_ERROR && status < 400) {
500+
if (status != NGX_ERROR && status < NGX_HTTP_CLOSE) {
501501
*errlen = ngx_snprintf(err, *errlen, "attempt to exit with the "
502-
"code smaller than 400 and not ngx.ERROR")
502+
"code not 444 or ngx.ERROR")
503503
- err;
504504
return NGX_ERROR;
505505
}
506506

507-
ctx->body_exited = 1;
507+
ctx->body_filter_aborted = 1;
508508
return NGX_OK;
509509
}
510510

t/082-body-filter.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ API disabled in the context of body_filter_by_lua*
881881
GET /t
882882
--- ignore_response
883883
--- error_log
884-
attempt to exit with the code smaller than 400 and not ngx.ERROR
884+
attempt to exit with the code not 444 or ngx.ERROR
885885
886886
887887

0 commit comments

Comments
 (0)