From 720504ff8f4ae2796fbcd6357f111e6f44ecb52b Mon Sep 17 00:00:00 2001 From: Jo Turk Date: Sun, 8 Feb 2026 16:13:29 +0200 Subject: [PATCH] Accept any value --- unmarshal.go | 29 +---------------------------- unmarshal_test.go | 13 ------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/unmarshal.go b/unmarshal.go index b423437..7e1cebe 100644 --- a/unmarshal.go +++ b/unmarshal.go @@ -873,34 +873,7 @@ func unmarshalMediaDescription(lex *lexer) (stateFn, error) { //nolint:cyclop if err != nil { return nil, err } - - // Set according to currently registered with IANA - // https://tools.ietf.org/html/rfc4566#section-5.14 - // https://tools.ietf.org/html/rfc4975#section-8.1 - for _, proto := range strings.Split(field, "/") { - if !anyOf( - proto, - "UDP", - "RTP", - "AVP", - "SAVP", - "SAVPF", - "TLS", - "DTLS", - "SCTP", - "AVPF", - "TCP", - "MSRP", - "BFCP", - "UDT", - "IX", - "MRCPv2", - "FEC", - ) { - return nil, fmt.Errorf("%w `%v`", errSDPInvalidNumericValue, field) - } - newMediaDesc.MediaName.Protos = append(newMediaDesc.MediaName.Protos, proto) - } + newMediaDesc.MediaName.Protos = strings.Split(field, "/") // ... for { diff --git a/unmarshal_test.go b/unmarshal_test.go index 6310bfc..27842de 100644 --- a/unmarshal_test.go +++ b/unmarshal_test.go @@ -1812,19 +1812,6 @@ func TestUnmarshalMediaDescription_SetsPortRange(t *testing.T) { } } -func TestUnmarshalMediaDescription_Error_InvalidProto(t *testing.T) { - // proto token not in the allowed list - l := &lexer{ - desc: &SessionDescription{}, - cache: &unmarshalCache{}, - baseLexer: baseLexer{value: "audio 9 WRONG/PROTO 0\r\n"}, - } - - st, err := unmarshalMediaDescription(l) - assert.Nil(t, st) - assert.ErrorIs(t, err, errSDPInvalidNumericValue) -} - func TestUnmarshalMediaTitle_Error_ReadLine(t *testing.T) { // empty input l := &lexer{