aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/http/request.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2011-06-28 09:43:14 +1000
committerRob Pike <r@golang.org>2011-06-28 09:43:14 +1000
commitebb1566a46f2f5b2c06ef0f7ad5f7084dce0aed9 (patch)
tree62c412f896baa504ae4a26d452f8cac6ce1aeed8 /src/pkg/http/request.go
parent82a8afdf1411bbe5b08b09d1e94a8d1c4fb5635c (diff)
downloadgo-ebb1566a46f2f5b2c06ef0f7ad5f7084dce0aed9.tar.xz
strings.Split: make the default to split all.
Change the signature of Split to have no count, assuming a full split, and rename the existing Split with a count to SplitN. Do the same to package bytes. Add a gofix module. R=adg, dsymonds, alex.brainman, rsc CC=golang-dev https://golang.org/cl/4661051
Diffstat (limited to 'src/pkg/http/request.go')
-rw-r--r--src/pkg/http/request.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/http/request.go b/src/pkg/http/request.go
index cd6965fa5d..456476a212 100644
--- a/src/pkg/http/request.go
+++ b/src/pkg/http/request.go
@@ -543,7 +543,7 @@ func ReadRequest(b *bufio.Reader) (req *Request, err os.Error) {
}
var f []string
- if f = strings.Split(s, " ", 3); len(f) < 3 {
+ if f = strings.SplitN(s, " ", 3); len(f) < 3 {
return nil, &badStringError{"malformed HTTP request", s}
}
req.Method, req.RawURL, req.Proto = f[0], f[1], f[2]
@@ -662,11 +662,11 @@ func ParseQuery(query string) (m Values, err os.Error) {
}
func parseQuery(m Values, query string) (err os.Error) {
- for _, kv := range strings.Split(query, "&", -1) {
+ for _, kv := range strings.Split(query, "&") {
if len(kv) == 0 {
continue
}
- kvPair := strings.Split(kv, "=", 2)
+ kvPair := strings.SplitN(kv, "=", 2)
var key, value string
var e os.Error
@@ -703,7 +703,7 @@ func (r *Request) ParseForm() (err os.Error) {
return os.NewError("missing form body")
}
ct := r.Header.Get("Content-Type")
- switch strings.Split(ct, ";", 2)[0] {
+ switch strings.SplitN(ct, ";", 2)[0] {
case "text/plain", "application/x-www-form-urlencoded", "":
const maxFormSize = int64(10 << 20) // 10 MB is a lot of text.
b, e := ioutil.ReadAll(io.LimitReader(r.Body, maxFormSize+1))