Skip to content

Commit 3b40eac

Browse files
committed
update for gc weekly.2011-07-07
1 parent 79dc98d commit 3b40eac

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

cookie.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func writeSetCookies(w io.Writer, kk []*http.Cookie) os.Error {
4949
}
5050
lines = append(lines, "Set-Cookie: "+b.String()+"\r\n")
5151
}
52-
sort.SortStrings(lines)
52+
sort.Strings(lines)
5353
for _, l := range lines {
5454
if _, err := io.WriteString(w, l); err != nil {
5555
return err
@@ -81,7 +81,7 @@ func writeCookies(w io.Writer, kk []*http.Cookie) os.Error {
8181
}
8282
lines = append(lines, "Cookie: "+b.String()+"\r\n")
8383
}
84-
sort.SortStrings(lines)
84+
sort.Strings(lines)
8585
for _, l := range lines {
8686
if _, err := io.WriteString(w, l); err != nil {
8787
return err
@@ -101,7 +101,7 @@ func readCookies(h http.Header) []*http.Cookie {
101101
}
102102
unparsedLines := []string{}
103103
for _, line := range lines {
104-
parts := strings.Split(strings.TrimSpace(line), ";", -1)
104+
parts := strings.Split(strings.TrimSpace(line), ";")
105105
if len(parts) == 1 && parts[0] == "" {
106106
continue
107107
}

request.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ func newRequestCgi(headers http.Header, body io.Reader) *Request {
141141

142142
func parseForm(m map[string][]string, query string) (err os.Error) {
143143
data := make(map[string]*vector.StringVector)
144-
for _, kv := range strings.Split(query, "&", -1) {
145-
kvPair := strings.Split(kv, "=", 2)
144+
for _, kv := range strings.Split(query, "&") {
145+
kvPair := strings.SplitN(kv, "=", 2)
146146

147147
var key, value string
148148
var e os.Error
@@ -185,7 +185,7 @@ func (r *Request) parseParams() (err os.Error) {
185185
}
186186

187187
ct := r.Headers.Get("Content-Type")
188-
switch strings.Split(ct, ";", 2)[0] {
188+
switch strings.SplitN(ct, ";", 2)[0] {
189189
case "text/plain", "application/x-www-form-urlencoded", "":
190190
var b []byte
191191
if b, err = ioutil.ReadAll(r.Body); err != nil {

scgi.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func readScgiRequest(buf *bytes.Buffer) (*Request, os.Error) {
8989
var err os.Error
9090
//find the CONTENT_LENGTH
9191

92-
clfields := bytes.Split(data, []byte{0}, 3)
92+
clfields := bytes.SplitN(data, []byte{0}, 3)
9393
if len(clfields) != 3 {
9494
return nil, os.NewError("Invalid SCGI Request -- no fields")
9595
}
@@ -105,7 +105,7 @@ func readScgiRequest(buf *bytes.Buffer) (*Request, os.Error) {
105105

106106
content := data[len(data)-clen:]
107107

108-
fields := bytes.Split(data[0:len(data)-clen], []byte{0}, -1)
108+
fields := bytes.Split(data[0:len(data)-clen], []byte{0})
109109

110110
for i := 0; i < len(fields)-1; i += 2 {
111111
key := string(fields[i])

web.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func (ctx *Context) GetSecureCookie(name string) (string, bool) {
135135
continue
136136
}
137137

138-
parts := strings.Split(cookie.Value, "|", 3)
138+
parts := strings.SplitN(cookie.Value, "|", 3)
139139

140140
val := parts[0]
141141
timestamp := parts[1]

web_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@ func buildTestResponse(buf *bytes.Buffer) *testResponse {
4646
response := testResponse{headers: make(map[string][]string), cookies: make(map[string]string)}
4747
s := buf.String()
4848

49-
contents := strings.Split(s, "\r\n\r\n", 2)
49+
contents := strings.SplitN(s, "\r\n\r\n", 2)
5050

5151
header := contents[0]
5252

5353
if len(contents) > 1 {
5454
response.body = contents[1]
5555
}
5656

57-
headers := strings.Split(header, "\r\n", -1)
57+
headers := strings.Split(header, "\r\n")
5858

59-
statusParts := strings.Split(headers[0], " ", 3)
59+
statusParts := strings.SplitN(headers[0], " ", 3)
6060
response.statusCode, _ = strconv.Atoi(statusParts[1])
6161

6262
for _, h := range headers[1:] {
63-
split := strings.Split(h, ":", 2)
63+
split := strings.SplitN(h, ":", 2)
6464
name := strings.TrimSpace(split[0])
6565
value := strings.TrimSpace(split[1])
6666
if _, ok := response.headers[name]; !ok {
@@ -76,7 +76,7 @@ func buildTestResponse(buf *bytes.Buffer) *testResponse {
7676
if name == "Set-Cookie" {
7777
i := strings.Index(value, ";")
7878
cookie := value[0:i]
79-
cookieParts := strings.Split(cookie, "=", 2)
79+
cookieParts := strings.SplitN(cookie, "=", 2)
8080
response.cookies[strings.TrimSpace(cookieParts[0])] = strings.TrimSpace(cookieParts[1])
8181
}
8282
}

0 commit comments

Comments
 (0)