Commit 732f2fa2 authored by Russ Cox's avatar Russ Cox

http: avoid crash when asked for multiple file ranges

R=adg
CC=golang-dev
https://golang.org/cl/4289076
parent 59a89268
......@@ -154,7 +154,10 @@ func serveFile(w ResponseWriter, r *Request, name string, redirect bool) {
// handle Content-Range header.
// TODO(adg): handle multiple ranges
ranges, err := parseRange(r.Header.Get("Range"), size)
if err != nil || len(ranges) > 1 {
if err == nil && len(ranges) > 1 {
err = os.ErrorString("multiple ranges not supported")
}
if err != nil {
Error(w, err.String(), StatusRequestedRangeNotSatisfiable)
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment