Skip to content

Commit

Permalink
fix(webrtc): Better Content-Type parsing
Browse files Browse the repository at this point in the history
Accept (optional) charsets

Close: bluenviron#3273
  • Loading branch information
fusetim authored and aler9 committed Apr 20, 2024
1 parent 2bd8ac7 commit 8f5ea81
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/protocols/webrtc/whip_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/url"
"strings"
"time"

"github.com/bluenviron/gortsplib/v4/pkg/format"
Expand Down Expand Up @@ -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)
}

Expand Down

0 comments on commit 8f5ea81

Please sign in to comment.