feat: logging client IP for served playlist and EPG
This commit is contained in:
@@ -164,6 +164,7 @@ func servePlaylist(cfg *Config, r *Refresher) http.HandlerFunc {
|
||||
http.Error(w, "stat", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
slog.Info("serving playlist", "client", clientIP(req))
|
||||
w.Header().Set("Content-Type", "application/vnd.apple.mpegurl")
|
||||
http.ServeContent(w, req, playlistFilename, fi.ModTime(), f)
|
||||
}
|
||||
@@ -188,7 +189,9 @@ func serveEPG(cfg *Config, r *Refresher) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
if clientAcceptsGzip(req) {
|
||||
gz := clientAcceptsGzip(req)
|
||||
slog.Info("serving epg", "client", clientIP(req), "gzip", gz)
|
||||
if gz {
|
||||
w.Header().Set("Content-Encoding", "gzip")
|
||||
w.Header().Set("Content-Type", cfg.EPGContentType)
|
||||
http.ServeContent(w, req, epgFilename, fi.ModTime(), f)
|
||||
|
||||
Reference in New Issue
Block a user