-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Labels
Area: TransportIncludes HTTP/2 client/server and HTTP server handler transports and advanced transport features.Includes HTTP/2 client/server and HTTP server handler transports and advanced transport features.Type: Bug
Description
While sending headers and trailers in the normal flow, gRPC ensures that the headers length is less than the limit specified by the peer. If not, a RST_STREAM frame is sent instead.
grpc-go/internal/transport/http2_server.go
Lines 1113 to 1125 in ae4bd1e
| success, err := t.controlBuf.executeAndPut(func() bool { | |
| return t.checkForHeaderListSize(trailingHeader) | |
| }, nil) | |
| if !success { | |
| if err != nil { | |
| return err | |
| } | |
| t.closeStream(s, true, http2.ErrCodeInternal, false) | |
| return ErrHeaderListSizeLimitViolation | |
| } | |
| // Send a RST_STREAM after the trailers if the client has not already half-closed. | |
| rst := s.getState() == streamActive | |
| t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true) |
grpc-go/internal/transport/http2_server.go
Lines 1044 to 1051 in ae4bd1e
| success, err := t.controlBuf.executeAndPut(func() bool { return t.checkForHeaderListSize(hf) }, hf) | |
| if !success { | |
| if err != nil { | |
| return err | |
| } | |
| t.closeStream(s, true, http2.ErrCodeInternal, false) | |
| return ErrHeaderListSizeLimitViolation | |
| } |
A similar check should also be performed when the server decides to abort the stream after parsing the client headers here:
grpc-go/internal/transport/controlbuf.go
Lines 855 to 859 in ae4bd1e
| } | |
| if err := l.writeHeader(eas.streamID, true, headerFields, nil); err != nil { | |
| return err | |
| } |
We should also add a test to catch regressions.
Metadata
Metadata
Assignees
Labels
Area: TransportIncludes HTTP/2 client/server and HTTP server handler transports and advanced transport features.Includes HTTP/2 client/server and HTTP server handler transports and advanced transport features.Type: Bug