Skip to content

Commit bdca519

Browse files
committed
Accept any <proto> value
1 parent 932dbd9 commit bdca519

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

unmarshal.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -874,31 +874,7 @@ func unmarshalMediaDescription(lex *lexer) (stateFn, error) { //nolint:cyclop
874874
return nil, err
875875
}
876876

877-
// Set according to currently registered with IANA
878-
// https://tools.ietf.org/html/rfc4566#section-5.14
879-
// https://tools.ietf.org/html/rfc4975#section-8.1
880877
for _, proto := range strings.Split(field, "/") {
881-
if !anyOf(
882-
proto,
883-
"UDP",
884-
"RTP",
885-
"AVP",
886-
"SAVP",
887-
"SAVPF",
888-
"TLS",
889-
"DTLS",
890-
"SCTP",
891-
"AVPF",
892-
"TCP",
893-
"MSRP",
894-
"BFCP",
895-
"UDT",
896-
"IX",
897-
"MRCPv2",
898-
"FEC",
899-
) {
900-
return nil, fmt.Errorf("%w `%v`", errSDPInvalidNumericValue, field)
901-
}
902878
newMediaDesc.MediaName.Protos = append(newMediaDesc.MediaName.Protos, proto)
903879
}
904880

unmarshal_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,19 +1812,6 @@ func TestUnmarshalMediaDescription_SetsPortRange(t *testing.T) {
18121812
}
18131813
}
18141814

1815-
func TestUnmarshalMediaDescription_Error_InvalidProto(t *testing.T) {
1816-
// proto token not in the allowed list
1817-
l := &lexer{
1818-
desc: &SessionDescription{},
1819-
cache: &unmarshalCache{},
1820-
baseLexer: baseLexer{value: "audio 9 WRONG/PROTO 0\r\n"},
1821-
}
1822-
1823-
st, err := unmarshalMediaDescription(l)
1824-
assert.Nil(t, st)
1825-
assert.ErrorIs(t, err, errSDPInvalidNumericValue)
1826-
}
1827-
18281815
func TestUnmarshalMediaTitle_Error_ReadLine(t *testing.T) {
18291816
// empty input
18301817
l := &lexer{

0 commit comments

Comments
 (0)