Fix gRPC lite header

Manually set the first byte to 0x00 (No Compression) since we can not ensure that the buffer is not polluted before.
This commit is contained in:
Hellojack 2023-01-16 16:23:06 +08:00 committed by GitHub
parent 8e0fe55363
commit 05620a369e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,6 +117,7 @@ func (c *GunConn) WriteBuffer(buffer *buf.Buffer) error {
dataLen := buffer.Len()
varLen := rw.UVariantLen(uint64(dataLen))
header := buffer.ExtendHeader(6 + varLen)
header[0] = 0x00
binary.BigEndian.PutUint32(header[1:5], uint32(1+varLen+dataLen))
header[5] = 0x0A
binary.PutUvarint(header[6:], uint64(dataLen))