]> git.kaiwu.me - njs.git/commit
Fetch: stop address failover once a response has started master
authorbasavaraj-sm05 <basavaraj@digiscrypt.com>
Sat, 5 Dec 2026 03:55:03 +0000 (19:55 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Sat, 5 Dec 2026 06:17:05 +0000 (22:17 -0800)
commit071864e6d2a1b0952733e89eccc16d3775724efe
treeee2b2c588ea23791961dfcede1b72f16358858dc
parent171997375599d36a13614d7acf332a9ffb96a52f
Fetch: stop address failover once a response has started

Previously, ngx_js_http_next() reconnected to the next resolved address
after a recv() or send() error at any stage of the exchange, resetting
only http->buffer.  If a read error occurred after the first peer had
already sent part of the response, the retry reused the dirty parser and
response state and an already destroyed request chain.

Now address failover is disabled once response bytes have been received
from the peer, and the fetch fails with "prematurely closed connection"
just like on an unexpected EOF.  For HTTPS via a forward proxy, the
flag is reset once the CONNECT tunnel is established so origin connect
failures are still handled as before.

The issue was introduced in 73c75e41 (0.5.1).
nginx/ngx_js_http.c
nginx/ngx_js_http.h
nginx/t/js_fetch_resolver.t