forked from quic-go/quic-go
accept Public Resets without the RSEQ tag
The RSEQ tag is mandatory according to the gQUIC spec, however, Google doesn't include that tag in its Public Resets.
This commit is contained in:
@@ -43,14 +43,15 @@ func ParsePublicReset(r *bytes.Reader) (*PublicReset, error) {
|
||||
return nil, errors.New("wrong public reset tag")
|
||||
}
|
||||
|
||||
rseq, ok := msg.Data[handshake.TagRSEQ]
|
||||
if !ok {
|
||||
return nil, errors.New("RSEQ missing")
|
||||
// The RSEQ tag is mandatory according to the gQUIC wire spec.
|
||||
// However, Google doesn't send RSEQ in their Public Resets.
|
||||
// Therefore, we'll treat RSEQ as an optional field.
|
||||
if rseq, ok := msg.Data[handshake.TagRSEQ]; ok {
|
||||
if len(rseq) != 8 {
|
||||
return nil, errors.New("invalid RSEQ tag")
|
||||
}
|
||||
pr.RejectedPacketNumber = protocol.PacketNumber(binary.LittleEndian.Uint64(rseq))
|
||||
}
|
||||
if len(rseq) != 8 {
|
||||
return nil, errors.New("invalid RSEQ tag")
|
||||
}
|
||||
pr.RejectedPacketNumber = protocol.PacketNumber(binary.LittleEndian.Uint64(rseq))
|
||||
|
||||
rnon, ok := msg.Data[handshake.TagRNON]
|
||||
if !ok {
|
||||
@@ -60,6 +61,5 @@ func ParsePublicReset(r *bytes.Reader) (*PublicReset, error) {
|
||||
return nil, errors.New("invalid RNON tag")
|
||||
}
|
||||
pr.Nonce = binary.LittleEndian.Uint64(rnon)
|
||||
|
||||
return &pr, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user