Skip to content

Commit

Permalink
fix(client/http): ffmpeg not works with proxy
Browse files Browse the repository at this point in the history
Go's resp.Write() adds a "Content-Length: 0" header and it seems that
ffmpeg doesn't like this and immediately closes the proxy connection.

close: #1109
  • Loading branch information
haruue committed May 30, 2024
1 parent 492145c commit e1ac7c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/internal/http/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func sendSimpleResponse(conn net.Conn, req *http.Request, statusCode int) error
ProtoMinor: req.ProtoMinor,
Header: http.Header{},
}
// Remove the "Content-Length: 0" header, some clients (e.g. ffmpeg) may not like it.
// NOTE: This will also cause go/http to add a "Connection: close" header, but seems to be fine.
resp.ContentLength = -1
return resp.Write(conn)
}

Expand Down

0 comments on commit e1ac7c8

Please sign in to comment.