From 7ffcd023e067e018a9a95b5bcf3ffec8d1f72297 Mon Sep 17 00:00:00 2001 From: emranemran Date: Thu, 1 Feb 2024 11:27:35 -0800 Subject: [PATCH] handlers: add headers as queryparam for pull sources --- handlers/geolocation/geolocation.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/handlers/geolocation/geolocation.go b/handlers/geolocation/geolocation.go index f5cc622bf..daa9fa502 100644 --- a/handlers/geolocation/geolocation.go +++ b/handlers/geolocation/geolocation.go @@ -169,7 +169,17 @@ func (c *GeolocationHandlersCollection) getStreamPull(playbackID string) (string return "", nil } - return stream.Pull.Source, nil + if len(stream.Pull.Headers) == 0 { + return stream.Pull.Source, nil + } + + var params []string + for k, v := range stream.Pull.Headers { + param := "addheader=" + url.QueryEscape(k+":"+v) + params = append(params, param) + } + finalPullURL := stream.Pull.Source + "?" + strings.Join(params, "&") + return finalPullURL, nil } func parsePlus(plusString string) (string, string) {