gRPC: narrowed special handling of "trailer only" responses

Previously, the response length was explicitly set to zero if the
initial HEADERS frame was seen with the END_STREAM flag.  This was
meant to properly pass responses in the Trailers-Only format as
introduced in 6559a42013.  This handling was too broad though,
passing incomplete responses that carry a non-zero Content-Length
to the client as if they were complete and empty.

Now such responses are caught by the existing checks later on and
are passed as incomplete, similarly to how this is handled elsewhere.
For instance, on HTTP/2 client connections this now results in proper
signalling, an incomplete stream followed by stream reset.
This commit is contained in:
Vinay Kumar Tokala authored and Vinay Kumar Tokala committed 2026-08-05 09:14:23 +05:30
1 parent 4b90ec7692
commit f340e7885a
1 file changed
+4 -1
+4 -1
View File
@@ -2047,7 +2047,10 @@ ngx_http_grpc_process_header(ngx_http_request_t *r)
}
if (ctx->end_stream) {
u->headers_in.content_length_n = 0;
if (u->headers_in.content_length_n == -1) {
u->headers_in.content_length_n = 0;
}
if (ctx->in == NULL
&& ctx->out == NULL