support authentication with vlc

This commit is contained in:
aler9
2020-06-14 20:06:37 +02:00
parent 2eddb95cab
commit 1173d41d78
3 changed files with 36 additions and 7 deletions

View File

@@ -46,11 +46,17 @@ func ReadHeaderAuth(in string) (*HeaderAuth, error) {
func (ha *HeaderAuth) Write() string {
ret := ha.Prefix + " "
// always put realm first, otherwise VLC does not send back the response
var sortedKeys []string
for key := range ha.Values {
sortedKeys = append(sortedKeys, key)
if key != "realm" {
sortedKeys = append(sortedKeys, key)
}
}
sort.Strings(sortedKeys)
if _, ok := ha.Values["realm"]; ok {
sortedKeys = append([]string{"realm"}, sortedKeys...)
}
var tmp []string
for _, key := range sortedKeys {