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 committed Apr 19, 2024
1 parent 2bd8ac7 commit e64b09a
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.Trim(strings.Split(contentType, ";")) != "application/sdp" {
return nil, fmt.Errorf("bad Content-Type: expected 'application/sdp', got '%s'", contentType)
}

Expand Down

0 comments on commit e64b09a

Please sign in to comment.