Skip to content
Snippets Groups Projects
Commit 89424b7d authored by ale's avatar ale
Browse files

Send full URLs in the generated M3U files

parent 44b76d10
Branches
Tags
No related merge requests found
......@@ -85,7 +85,7 @@ func newHTTPHandler(n *Node, icecastPort int, domain string) http.Handler {
withMount(n, func(m *pb.Mount, w http.ResponseWriter, r *http.Request) {
doIcecastProxy(w, r, &url.URL{
Scheme: "http",
Host: fmt.Sprintf("localhost:%d", icecastPort),
Host: fmt.Sprintf("127.0.0.1:%d", icecastPort),
Path: autoradio.MountPathToIcecastPath(m.Path),
}, m.Path)
}))
......@@ -195,7 +195,9 @@ func serveRedirect(lb *loadBalancer, mount *pb.Mount, w http.ResponseWriter, r *
// Serve a M3U response. This simply points back at the stream
// redirect handler by dropping the .m3u suffix in the request URL.
func sendM3U(w http.ResponseWriter, r *http.Request) {
m3u := strings.TrimSuffix(r.URL.String(), ".m3u") + "\n"
// Build a fully qualified URL using the Host header.
m3u := fmt.Sprintf("http://%s%s\n", r.Host, strings.TrimSuffix(r.URL.Path, ".m3u"))
w.Header().Set("Content-Length", strconv.Itoa(len(m3u)))
w.Header().Set("Content-Type", "audio/x-mpegurl")
addDefaultHeaders(w)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment