diff options
author | Rob Pike <r@golang.org> | 2010-07-01 14:08:14 -0700 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2010-07-01 14:08:14 -0700 |
commit | 09483cecfdbe2780fcb8fe9a9bbc2d57ba896598 (patch) | |
tree | 5b188afe344ef0e4cb39832efc2d76613bc2e5e2 /src/pkg/http | |
parent | b663d01257198c5407733986b3f1b8253642409d (diff) | |
download | go-09483cecfdbe2780fcb8fe9a9bbc2d57ba896598.tar.gz |
strings and bytes.Split: make count of 0 mean 0, not infinite.
Use a count of -1 for infinity. Ditto for Replace.
R=rsc
CC=golang-dev
http://codereview.appspot.com/1704044
Committer: Rob Pike <r@golang.org>
Diffstat (limited to 'src/pkg/http')
-rw-r--r-- | src/pkg/http/request.go | 2 | ||||
-rw-r--r-- | src/pkg/http/transfer.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/pkg/http/request.go b/src/pkg/http/request.go index b1aface46..8a72d6cfa 100644 --- a/src/pkg/http/request.go +++ b/src/pkg/http/request.go @@ -568,7 +568,7 @@ func ReadRequest(b *bufio.Reader) (req *Request, err os.Error) { func ParseQuery(query string) (m map[string][]string, err os.Error) { m = make(map[string][]string) - for _, kv := range strings.Split(query, "&", 0) { + for _, kv := range strings.Split(query, "&", -1) { kvPair := strings.Split(kv, "=", 2) var key, value string diff --git a/src/pkg/http/transfer.go b/src/pkg/http/transfer.go index 26266cbca..5e190d74c 100644 --- a/src/pkg/http/transfer.go +++ b/src/pkg/http/transfer.go @@ -269,7 +269,7 @@ func fixTransferEncoding(header map[string]string) ([]string, os.Error) { } header["Transfer-Encoding"] = "", false - encodings := strings.Split(raw, ",", 0) + encodings := strings.Split(raw, ",", -1) te := make([]string, 0, len(encodings)) // TODO: Even though we only support "identity" and "chunked" // encodings, the loop below is designed with foresight. One @@ -373,7 +373,7 @@ func fixTrailer(header map[string]string, te []string) (map[string]string, os.Er header["Trailer"] = "", false trailer := make(map[string]string) - keys := strings.Split(raw, ",", 0) + keys := strings.Split(raw, ",", -1) for _, key := range keys { key = CanonicalHeaderKey(strings.TrimSpace(key)) switch key { |