From e64b09ae4c19bd5fa4c07fc6a983437dfa8f42cc Mon Sep 17 00:00:00 2001 From: FuseTim Date: Fri, 19 Apr 2024 10:49:11 +0200 Subject: [PATCH] fix(webrtc): Better Content-Type parsing Accept (optional) charsets Close: #3273 --- internal/protocols/webrtc/whip_client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/protocols/webrtc/whip_client.go b/internal/protocols/webrtc/whip_client.go index 0a6299648bc..11ba4c6904e 100644 --- a/internal/protocols/webrtc/whip_client.go +++ b/internal/protocols/webrtc/whip_client.go @@ -7,6 +7,7 @@ import ( "io" "net/http" "net/url" + "strings" "time" "github.com/bluenviron/gortsplib/v4/pkg/format" @@ -285,7 +286,7 @@ func (c *WHIPClient) postOffer( } contentType := res.Header.Get("Content-Type") - if contentType != "application/sdp" { + if strings.Trim(strings.Split(contentType, ";")) != "application/sdp" { return nil, fmt.Errorf("bad Content-Type: expected 'application/sdp', got '%s'", contentType) }