Skip to content

Commit

Permalink
properly detect if chunked tranfer encoding is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ugjka committed Feb 13, 2024
1 parent 678294b commit 7969a98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion audio_serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type source string

func (s source) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if *headers {
spew.Fdump(os.Stderr, r.Proto)
spew.Fdump(os.Stderr, r.RemoteAddr)
spew.Fdump(os.Stderr, r.URL)
spew.Fdump(os.Stderr, r.Method)
Expand Down Expand Up @@ -68,7 +69,8 @@ func (s source) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
w.Header().Add("Content-Type", "audio/mpeg")

flusher, chunked := w.(http.Flusher)
flusher, ok := w.(http.Flusher)
chunked := ok && r.Proto == "HTTP/1.1"

if !chunked {
var yearBytes = yearSeconds * (MP3BITRATE / 8) * 1000
Expand Down

0 comments on commit 7969a98

Please sign in to comment.