mirror of
https://github.com/pierre-emmanuelJ/iptv-proxy.git
synced 2026-03-13 06:35:29 +01:00
Copy http header
Signed-off-by: Pierre-Emmanuel Jacquier <pierre-emmanuel.jacquier@epitech.eu>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/jamesnetherton/m3u"
|
||||
|
||||
@@ -67,6 +68,7 @@ func (p *proxy) reverseProxy(c *gin.Context) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
copyHTTPHeader(c, resp.Header)
|
||||
c.Status(resp.StatusCode)
|
||||
c.Stream(func(w io.Writer) bool {
|
||||
io.Copy(w, resp.Body)
|
||||
@@ -74,6 +76,12 @@ func (p *proxy) reverseProxy(c *gin.Context) {
|
||||
})
|
||||
}
|
||||
|
||||
func copyHTTPHeader(c *gin.Context, header http.Header) {
|
||||
for k, v := range header {
|
||||
c.Header(k, strings.Join(v, ", "))
|
||||
}
|
||||
}
|
||||
|
||||
func (p *proxy) getM3U(c *gin.Context) {
|
||||
playlist, err := proxyM3U.ReplaceURL(p.ProxyConfig)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user