Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(791)

Side by Side Diff: src/pkg/http/header.go

Issue 4631098: code review 4631098: sort: rename helpers: s/Sort// in sort.Sort[Float64s|In... (Closed)
Patch Set: diff -r e276ba524959 https://go.googlecode.com/hg/ Created 13 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/go/doc/doc.go ('k') | src/pkg/index/suffixarray/suffixarray.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package http 5 package http
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "io" 9 "io"
10 "net/textproto" 10 "net/textproto"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // WriteSubset writes a header in wire format. 50 // WriteSubset writes a header in wire format.
51 // If exclude is not nil, keys where exclude[key] == true are not written. 51 // If exclude is not nil, keys where exclude[key] == true are not written.
52 func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) os.Error { 52 func (h Header) WriteSubset(w io.Writer, exclude map[string]bool) os.Error {
53 keys := make([]string, 0, len(h)) 53 keys := make([]string, 0, len(h))
54 for k := range h { 54 for k := range h {
55 if exclude == nil || !exclude[k] { 55 if exclude == nil || !exclude[k] {
56 keys = append(keys, k) 56 keys = append(keys, k)
57 } 57 }
58 } 58 }
59 » sort.SortStrings(keys) 59 » sort.Strings(keys)
60 for _, k := range keys { 60 for _, k := range keys {
61 for _, v := range h[k] { 61 for _, v := range h[k] {
62 v = strings.Replace(v, "\n", " ", -1) 62 v = strings.Replace(v, "\n", " ", -1)
63 v = strings.Replace(v, "\r", " ", -1) 63 v = strings.Replace(v, "\r", " ", -1)
64 v = strings.TrimSpace(v) 64 v = strings.TrimSpace(v)
65 if _, err := fmt.Fprintf(w, "%s: %s\r\n", k, v); err != nil { 65 if _, err := fmt.Fprintf(w, "%s: %s\r\n", k, v); err != nil {
66 return err 66 return err
67 } 67 }
68 } 68 }
69 } 69 }
70 return nil 70 return nil
71 } 71 }
72 72
73 // CanonicalHeaderKey returns the canonical format of the 73 // CanonicalHeaderKey returns the canonical format of the
74 // header key s. The canonicalization converts the first 74 // header key s. The canonicalization converts the first
75 // letter and any letter following a hyphen to upper case; 75 // letter and any letter following a hyphen to upper case;
76 // the rest are converted to lowercase. For example, the 76 // the rest are converted to lowercase. For example, the
77 // canonical key for "accept-encoding" is "Accept-Encoding". 77 // canonical key for "accept-encoding" is "Accept-Encoding".
78 func CanonicalHeaderKey(s string) string { return textproto.CanonicalMIMEHeaderK ey(s) } 78 func CanonicalHeaderKey(s string) string { return textproto.CanonicalMIMEHeaderK ey(s) }
OLDNEW
« no previous file with comments | « src/pkg/go/doc/doc.go ('k') | src/pkg/index/suffixarray/suffixarray.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b