mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-04 07:56:33 +08:00
fix: return 461 if client requested an invalid transport method
This commit is contained in:

committed by
GitHub

parent
29f7f1a57d
commit
fd125ecc68
@@ -150,6 +150,10 @@ func (c *Conn) Accept() error {
|
||||
|
||||
const transport = "RTP/AVP/TCP;unicast"
|
||||
|
||||
// Test if client requests unicast with TCP transport, otherwise return 461 Transport not supported
|
||||
// This allows smart clients who initially requested UDP to fall back on TCP transport.
|
||||
if strings.HasPrefix(tr, transport) {
|
||||
|
||||
c.session = core.RandString(8, 10)
|
||||
c.state = StateSetup
|
||||
|
||||
@@ -173,6 +177,9 @@ func (c *Conn) Accept() error {
|
||||
} else {
|
||||
res.Header.Set("Transport", tr)
|
||||
}
|
||||
else {
|
||||
res.Status = "461 Unsupported transport"
|
||||
}
|
||||
|
||||
if err = c.WriteResponse(res); err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user