mirror of
https://github.com/bluenviron/mediamtx
synced 2025-02-15 19:17:12 +00:00
fix authentication with VLC
This fixes the case in which VLC is trying to read a path with a query (i.e. stream?mykey=myval) and the path requires read credentials.
This commit is contained in:
parent
6524130ab9
commit
57015e2bf0
@ -191,17 +191,18 @@ func (s *rtspSession) onSetup(c *rtspConn, ctx *gortsplib.ServerHandlerOnSetupCt
|
|||||||
pathPass conf.Credential,
|
pathPass conf.Credential,
|
||||||
) error {
|
) error {
|
||||||
baseURL := &url.URL{
|
baseURL := &url.URL{
|
||||||
Scheme: ctx.Request.URL.Scheme,
|
Scheme: ctx.Request.URL.Scheme,
|
||||||
Host: ctx.Request.URL.Host,
|
Host: ctx.Request.URL.Host,
|
||||||
Path: func() string {
|
Path: ctx.Path,
|
||||||
pa := ctx.Path
|
RawQuery: ctx.Query,
|
||||||
if ctx.Query != "" {
|
|
||||||
pa += "?" + ctx.Query
|
|
||||||
}
|
|
||||||
pa += "/"
|
|
||||||
return pa
|
|
||||||
}(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Query != "" {
|
||||||
|
baseURL.RawQuery += "/"
|
||||||
|
} else {
|
||||||
|
baseURL.Path += "/"
|
||||||
|
}
|
||||||
|
|
||||||
return c.authenticate(ctx.Path, ctx.Query, pathIPs, pathUser, pathPass, false, ctx.Request, baseURL)
|
return c.authenticate(ctx.Path, ctx.Query, pathIPs, pathUser, pathPass, false, ctx.Request, baseURL)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user