From 8f5ea812a9723798f35fde091decf6188858f2ed 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..6feb51f2a47 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.TrimSpace(strings.Split(contentType, ";")[0]) != "application/sdp" { return nil, fmt.Errorf("bad Content-Type: expected 'application/sdp', got '%s'", contentType) }