1
0

Send only a response code without any text to Icecast and Ezstream.

This commit is contained in:
Alexander Andreev 2024-05-22 03:40:33 +04:00
parent b155b81064
commit f265494ea8
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -36,7 +36,7 @@ func (dj *DJHandlers) ListenersUpdateIcecast(w http.ResponseWriter, r *http.Requ
if err := r.ParseForm(); err != nil {
log.Println("DJHandlers.ListenersUpdateIcecast:", err)
http.Error(w, "cannot parse form", http.StatusBadRequest)
w.WriteHeader(http.StatusBadRequest)
return
}
@ -46,7 +46,7 @@ func (dj *DJHandlers) ListenersUpdateIcecast(w http.ResponseWriter, r *http.Requ
case "listener_remove":
if _, err := dj.listeners.Dec(); err != nil {
log.Println("DJHandlers.ListenersUpdateIcecast:", err)
http.Error(w, err.Error(), http.StatusBadRequest)
w.WriteHeader(http.StatusBadRequest)
return
}
default:
@ -70,7 +70,7 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) {
log.Println("the end of a playlist has been reached")
if nxt = dj.fallbackSong; nxt == "" {
log.Println("a fallback song is not set")
http.Error(w, "a playlist is empty and a fallback song is not set", http.StatusNotFound)
w.WriteHeader(http.StatusNotFound)
return
}
}
@ -78,7 +78,7 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) {
oggf, err := oggtag.NewOggFile(nxt)
if err != nil {
log.Println("cannot read an OGG file", nxt, ":", err)
http.Error(w, "cannot read an OGG file", http.StatusInternalServerError)
w.WriteHeader(http.StatusInternalServerError)
return
}