]> git.feebdaed.xyz Git - 0xmirror/grpc-go.git/commit
transport: add status details even when aborting early (#8754)
authorJoy Bestourous <32601978+joybestourous@users.noreply.github.com>
Mon, 15 Dec 2025 06:25:03 +0000 (01:25 -0500)
committerGitHub <noreply@github.com>
Mon, 15 Dec 2025 06:25:03 +0000 (11:55 +0530)
commit4b2d967bc7b7db4554e51fbc069a29bb26d362e9
treec4378c578aa5e2310c4637612015c682210bd0f1
parent9fd5d8aa03e6f7380f9bec3a8c836b3bf31954e7
transport: add status details even when aborting early (#8754)

Modifies `earlyAbortStreamHandler` to include status details if present.

Most use cases of `earlyAbortStreamHandler` are for circumstances where
there are certainly no error details (bad HTTP methods, bad
content-type, internal error, etc). However, tap handlers also typically
go through the `earlyAbortStreamHandler`. In `http2_server.go`:
```
if t.inTapHandle != nil {
var err error
if s.ctx, err = t.inTapHandle(s.ctx, &tap.Info{FullMethodName: s.method, Header: mdata}); err != nil {
t.mu.Unlock()
if t.logger.V(logLevel) {
t.logger.Infof("Aborting the stream early due to InTapHandle failure: %v", err)
}
stat, ok := status.FromError(err)
if !ok {
stat = status.New(codes.PermissionDenied, err.Error())
}
t.controlBuf.put(&earlyAbortStream{
// ...
status:         stat,  // <-- CAN have details!
})
```
Yet the handler does **not** include error details by default, limiting
how tap handlers can be used and breaking some user assumptions
surrounding which information is propagated.
This PR fixes this by checking for status details and including the
header for them if present.

RELEASE NOTES:
* transport: propagate status details from tap handlers.
internal/transport/controlbuf.go
test/end2end_test.go