Tags: openresty/lua-nginx-module
Tags
bugfix: ngx.flush() buffer could be recycled while still queued. (#2518) Buffer taken from ctx->free_bufs with tag and with size 0 would be returned to the ctx->free_bufs by ngx_chain_update_chains(). When reused, it results into memzeroing the flush flag and "zero size buf in writer t:1 r:0 f:0" alerts.
bugfix: clean child coroutine ops when killing uthreads. Cancel descendant coroutine operations before deleting killed user threads so delayed cosocket events cannot resume collected Lua states.
style: fixed code style. Use nginx macros instead of the original "memmove" and remove unnecessary spaces.
bugfix: get_client_hello_ext returned NGX_OK on OOM with NULL extensi…
…ons.
ngx_http_lua_ffi_ssl_get_client_hello_ext() did:
*extensions = ngx_palloc(...);
if (*extensions != NULL) {
ngx_memcpy(...);
*extensions_len = ext_len;
}
return NGX_OK;
so when ngx_palloc() failed the function left *extensions NULL and
*extensions_len untouched, but still reported success. The Lua FFI
caller then dereferenced a NULL pointer or read whatever junk was in
the output-length slot.
Treat the allocation failure as an error: free the OpenSSL-allocated
buffer, set *err, and return NGX_ERROR.
bugfix: failed to override headers (e.g. WWW-Authenticate) copied fro… …m upstream. When a builtin multi-value header (such as WWW-Authenticate) is copied from the upstream response via ngx_http_upstream_copy_header_line with offset 0, the corresponding r->headers_out.<field> pointer stays NULL even though the header is present in r->headers_out.headers. As a result, setting ngx.header[name] from Lua would append a new entry instead of overwriting the existing one. Walk r->headers_out.headers to overwrite the first match and clear the rest, then repoint *headers so subsequent multi-header semantics keep working. The same fix is applied to the pre-1.23.0 array-based code path.
bugfix: SIGSEGV in receiveuntil __gc on aborted multipart upload. (#2504 ) read_error_retval_handler calls finalize_read_part directly when the receiveuntil iterator's recv errors. That clears u->buf_in but leaves cp->upstream live with cp->state > 0. Later GC fires cleanup_compiled_pattern -> read_prepare, which derefs the now-NULL u->buf_in. Mirror tcp_finalize's cp->upstream = NULL detach so __gc's existing `if (u != NULL)` guard short-circuits. Backtrace: ngx_http_lua_socket_tcp_read_prepare ngx_http_lua_socket_cleanup_compiled_pattern lj_BC_FUNCC gc_call_finalizer gc_finalize gc_onestep lj_gc_fullgc lua_gc lj_cf_collectgarbage lj_BC_FUNCC ngx_http_lua_run_thread ngx_http_lua_socket_tcp_resume_helper ngx_http_lua_access_handler ngx_http_core_access_phase ngx_http_core_run_phases ngx_http_lua_socket_tcp_read ngx_http_request_handler ngx_epoll_process_events ngx_process_events_and_timers ngx_worker_process_cycle ngx_spawn_process ngx_start_worker_processes ngx_master_process_cycle main * add tests. --------- Co-authored-by: lijunlong <lijunlong@openresty.com>
tests: Improving the success rate of the test, as it relies on the pu… …blic network, may still fail.
PreviousNext