mirror of
https://github.com/golang/go
synced 2024-11-20 03:04:40 -07:00
http: avoid crash when asked for multiple file ranges
R=adg CC=golang-dev https://golang.org/cl/4289076
This commit is contained in:
parent
59a8926829
commit
732f2fa2c1
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user