aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/cookiejar/jar.go2
-rw-r--r--src/net/http/fs.go4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/net/http/cookiejar/jar.go b/src/net/http/cookiejar/jar.go
index db6bcddb26..bad2a67f13 100644
--- a/src/net/http/cookiejar/jar.go
+++ b/src/net/http/cookiejar/jar.go
@@ -219,7 +219,7 @@ func (j *Jar) cookies(u *url.URL, now time.Time) (cookies []*http.Cookie) {
}
modified := false
- var selected []entry
+ selected := make([]entry, 0, len(submap))
for id, e := range submap {
if e.Persistent && !e.Expires.After(now) {
delete(submap, id)
diff --git a/src/net/http/fs.go b/src/net/http/fs.go
index 92bd94f72d..477d341f0b 100644
--- a/src/net/http/fs.go
+++ b/src/net/http/fs.go
@@ -1020,7 +1020,9 @@ func parseRange(s string, size int64) ([]httpRange, error) {
if !strings.HasPrefix(s, b) {
return nil, errors.New("invalid range")
}
- var ranges []httpRange
+
+ splits := strings.Split(s[len(b):], ",")
+ ranges := make([]httpRange, 0, len(splits))
noOverlap := false
for ra := range strings.SplitSeq(s[len(b):], ",") {
ra = textproto.TrimString(ra)