aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-03-27 23:35:31 -0400
committerRuss Cox <rsc@golang.org>2011-03-27 23:35:31 -0400
commit732f2fa2c19394f938848c2b284e6b76c72a9e99 (patch)
treee60250ca3e6408cd96f103ef4d977aff33b811da
parent59a892682908789fe74124f7b97ab11c9c8d2b92 (diff)
downloadgo-732f2fa2c19394f938848c2b284e6b76c72a9e99.tar.gz
go-732f2fa2c19394f938848c2b284e6b76c72a9e99.zip
http: avoid crash when asked for multiple file ranges
R=adg CC=golang-dev https://golang.org/cl/4289076
-rw-r--r--src/pkg/http/fs.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pkg/http/fs.go b/src/pkg/http/fs.go
index 4ad680ccc3..8b5c4770c4 100644
--- a/src/pkg/http/fs.go
+++ b/src/pkg/http/fs.go
@@ -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
}