forked from quic-go/quic-go
implement the IETF draft 10 header changes
This commit is contained in:
@@ -50,6 +50,7 @@ func ParseHeaderSentByServer(b *bytes.Reader, version protocol.VersionNumber) (*
|
||||
// the client knows the version that this packet was sent with
|
||||
isPublicHeader = !version.UsesTLS()
|
||||
}
|
||||
|
||||
return parsePacketHeader(b, protocol.PerspectiveServer, isPublicHeader)
|
||||
}
|
||||
|
||||
@@ -61,12 +62,13 @@ func ParseHeaderSentByClient(b *bytes.Reader) (*Header, error) {
|
||||
}
|
||||
_ = b.UnreadByte() // unread the type byte
|
||||
|
||||
// If this is a gQUIC header 0x80 and 0x40 will be set to 0.
|
||||
// If this is an IETF QUIC header there are two options:
|
||||
// * either 0x80 will be 1 (for the Long Header)
|
||||
// * or 0x40 (the Connection ID Flag) will be 0 (for the Short Header), since we don't the client to omit it
|
||||
isPublicHeader := typeByte&0xc0 == 0
|
||||
|
||||
// In an IETF QUIC packet header
|
||||
// * either 0x80 is set (for the Long Header)
|
||||
// * or 0x8 is unset (for the Short Header)
|
||||
// In a gQUIC Public Header
|
||||
// * 0x80 is always unset and
|
||||
// * and 0x8 is always set (this is the Connection ID flag, which the client always sets)
|
||||
isPublicHeader := typeByte&0x88 == 0x8
|
||||
return parsePacketHeader(b, protocol.PerspectiveClient, isPublicHeader)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user