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: #3273
  • Loading branch information
fusetim committed Apr 19, 2024
1 parent 2bd8ac7 commit 126fa08
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"

Check failure on line 10 in internal/protocols/webrtc/whip_client.go

View workflow job for this annotation

GitHub Actions / golangci_lint

File is not `gofmt`-ed with `-s` (gofmt)
"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 126fa08

Please sign in to comment.