Browse Source

print debug log message in case of non-critical authentication errors

pull/764/head v0.17.12
aler9 5 years ago
parent
commit
ed635db87e
  1. 3
      internal/core/path.go
  2. 2
      internal/core/rtsp_conn.go
  3. 2
      internal/core/rtsp_session.go

3
internal/core/path.go

@ -39,7 +39,8 @@ func (e pathErrNoOnePublishing) Error() string { @@ -39,7 +39,8 @@ func (e pathErrNoOnePublishing) Error() string {
}
type pathErrAuthNotCritical struct {
*base.Response
Message string
Response *base.Response
}
// Error implements the error interface.

2
internal/core/rtsp_conn.go

@ -147,6 +147,7 @@ func (c *rtspConn) authenticate( @@ -147,6 +147,7 @@ func (c *rtspConn) authenticate(
v := "IPCAM"
return pathErrAuthNotCritical{
Message: "unauthorized: " + err.Error(),
Response: &base.Response{
StatusCode: base.StatusUnauthorized,
Header: base.Header{
@ -253,6 +254,7 @@ func (c *rtspConn) onDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx, @@ -253,6 +254,7 @@ func (c *rtspConn) onDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx,
if res.Err != nil {
switch terr := res.Err.(type) {
case pathErrAuthNotCritical:
c.log(logger.Debug, "non-critical authentication error: %s", terr.Message)
return terr.Response, nil, nil
case pathErrAuthCritical:

2
internal/core/rtsp_session.go

@ -168,6 +168,7 @@ func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnno @@ -168,6 +168,7 @@ func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnno
if res.Err != nil {
switch terr := res.Err.(type) {
case pathErrAuthNotCritical:
s.log(logger.Debug, "non-critical authentication error: %s", terr.Message)
return terr.Response, nil
case pathErrAuthCritical:
@ -226,6 +227,7 @@ func (s *rtspSession) onSetup(c *rtspConn, ctx *gortsplib.ServerHandlerOnSetupCt @@ -226,6 +227,7 @@ func (s *rtspSession) onSetup(c *rtspConn, ctx *gortsplib.ServerHandlerOnSetupCt
if res.Err != nil {
switch terr := res.Err.(type) {
case pathErrAuthNotCritical:
s.log(logger.Debug, "non-critical authentication error: %s", terr.Message)
return terr.Response, nil, nil
case pathErrAuthCritical:

Loading…
Cancel
Save