From da3137b6f08697cb7d5db0a3ee433148734996c4 Mon Sep 17 00:00:00 2001 From: Alexey Khit Date: Fri, 3 Feb 2023 14:11:30 +0300 Subject: [PATCH] Add User-Agent to RTSP Describe #235 --- pkg/rtsp/conn.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/rtsp/conn.go b/pkg/rtsp/conn.go index bc9fe734..40c07fd2 100644 --- a/pkg/rtsp/conn.go +++ b/pkg/rtsp/conn.go @@ -304,6 +304,12 @@ func (c *Conn) Describe() error { req.Header.Set("Require", "www.onvif.org/ver20/backchannel") } + if c.UserAgent != "" { + // this camera will answer with 401 on DESCRIBE without User-Agent + // https://github.com/AlexxIT/go2rtc/issues/235 + req.Header.Set("User-Agent", c.UserAgent) + } + res, err := c.Do(req) if err != nil { return err