-
Notifications
You must be signed in to change notification settings - Fork 443
Open
Description
Versions of relevant software used
v0.15.0
What happened
The wrapHandler function does not check Trailers-Only case and adds extra data to trailers.
grpc-web/go/grpcweb/grpc_web_response.go
Lines 97 to 106 in 1d9bbb0
func (w *grpcWebResponse) copyTrailersToPayload() { | |
trailers := extractTrailingHeaders(w.headers, w.wrapped.Header()) | |
trailerBuffer := new(bytes.Buffer) | |
trailers.Write(trailerBuffer) | |
trailerGrpcDataHeader := []byte{1 << 7, 0, 0, 0, 0} // MSB=1 indicates this is a trailer data frame. | |
binary.BigEndian.PutUint32(trailerGrpcDataHeader[1:5], uint32(trailerBuffer.Len())) | |
w.wrapped.Write(trailerGrpcDataHeader) | |
w.wrapped.Write(trailerBuffer.Bytes()) | |
flushWriter(w.wrapped) | |
} |
It's about line 101
Instead of empty trailers in the case of Trailers-Only, I get a trailer with 0x80 0x0 0x0 0x0 0x0
What you expected to happen
In the case of Trailers-Only, Trailer must remain empty. In the response from the server only headers are involved
How to reproduce it (as minimally and precisely as possible):
Your library uses the traefik gateway, which allows the case of Trailers-Only.
Metadata
Metadata
Assignees
Labels
No labels