Sizable Stream Readers (Range Requests)
Stream Reader supports a new method called Size(). Size returns the size of the entire stream at this moment, and a bool which is true if and only if the stream is closed. If the stream is closed, then the size will be constant from then on, and range requests can be done via an io.SectionReader over the reader like so:
var r stream.Reader
if size, isClosed := r.Size(); isClosed {
sr := io.NewSectionReader(r, 0, size)
http.ServeContent(rw, req, name, modTime, sr)
}
// otherwise just do regular request writing