]> git.kaiwu.me - nginx.git/commit
Upstream: detect premature plain text response from SSL backend.
authorRoman Arutyunyan <arut@nginx.com>
Thu, 29 Jan 2026 09:27:32 +0000 (13:27 +0400)
committerRoman Arutyunyan <arutyunyan.roman@gmail.com>
Wed, 4 Feb 2026 15:09:20 +0000 (19:09 +0400)
commita59f5f099a89dc8eaebd48077292313f9f7e33e3
treee0e4c3da6aecb0ec6223c70fbf9d4ebff164dbcf
parent86e5930e7697c824a70d807ee1d9ebc27eb99990
Upstream: detect premature plain text response from SSL backend.

When connecting to a backend, the connection write event is triggered
first in most cases.  However if a response arrives quickly enough, both
read and write events can be triggered together within the same event loop
iteration.  In this case the read event handler is called first and the
write event handler is called after it.

SSL initialization for backend connections happens only in the write event
handler since SSL handshake starts with sending Client Hello.  Previously,
if a backend sent a quick plain text response, it could be parsed by the
read event handler prior to starting SSL handshake on the connection.
The change adds protection against parsing such responses on SSL-enabled
connections.
src/http/ngx_http_upstream.c