mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 04:37:36 +03:00
refactor parsing of headers with invalid reserved bits
This commit is contained in:
parent
9d6ae474d7
commit
490d9ddab2
2 changed files with 20 additions and 14 deletions
|
@ -241,7 +241,15 @@ func (h *Header) ParsedLen() protocol.ByteCount {
|
|||
// ParseExtended parses the version dependent part of the header.
|
||||
// The Reader has to be set such that it points to the first byte of the header.
|
||||
func (h *Header) ParseExtended(b *bytes.Reader, ver protocol.VersionNumber) (*ExtendedHeader, error) {
|
||||
return h.toExtendedHeader().parse(b, ver)
|
||||
extHdr := h.toExtendedHeader()
|
||||
reservedBitsValid, err := extHdr.parse(b, ver)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !reservedBitsValid {
|
||||
return extHdr, ErrInvalidReservedBits
|
||||
}
|
||||
return extHdr, nil
|
||||
}
|
||||
|
||||
func (h *Header) toExtendedHeader() *ExtendedHeader {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue