aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/golang.org/x/net/http2/http2.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/http2/http2.go')
-rw-r--r--vendor/golang.org/x/net/http2/http2.go25
1 files changed, 9 insertions, 16 deletions
diff --git a/vendor/golang.org/x/net/http2/http2.go b/vendor/golang.org/x/net/http2/http2.go
index d565f40..bdaba1d 100644
--- a/vendor/golang.org/x/net/http2/http2.go
+++ b/vendor/golang.org/x/net/http2/http2.go
@@ -29,7 +29,7 @@ import (
29 "strings" 29 "strings"
30 "sync" 30 "sync"
31 31
32 "golang.org/x/net/lex/httplex" 32 "golang.org/x/net/http/httpguts"
33) 33)
34 34
35var ( 35var (
@@ -179,7 +179,7 @@ var (
179) 179)
180 180
181// validWireHeaderFieldName reports whether v is a valid header field 181// validWireHeaderFieldName reports whether v is a valid header field
182// name (key). See httplex.ValidHeaderName for the base rules. 182// name (key). See httpguts.ValidHeaderName for the base rules.
183// 183//
184// Further, http2 says: 184// Further, http2 says:
185// "Just as in HTTP/1.x, header field names are strings of ASCII 185// "Just as in HTTP/1.x, header field names are strings of ASCII
@@ -191,7 +191,7 @@ func validWireHeaderFieldName(v string) bool {
191 return false 191 return false
192 } 192 }
193 for _, r := range v { 193 for _, r := range v {
194 if !httplex.IsTokenRune(r) { 194 if !httpguts.IsTokenRune(r) {
195 return false 195 return false
196 } 196 }
197 if 'A' <= r && r <= 'Z' { 197 if 'A' <= r && r <= 'Z' {
@@ -201,19 +201,12 @@ func validWireHeaderFieldName(v string) bool {
201 return true 201 return true
202} 202}
203 203
204var httpCodeStringCommon = map[int]string{} // n -> strconv.Itoa(n)
205
206func init() {
207 for i := 100; i <= 999; i++ {
208 if v := http.StatusText(i); v != "" {
209 httpCodeStringCommon[i] = strconv.Itoa(i)
210 }
211 }
212}
213
214func httpCodeString(code int) string { 204func httpCodeString(code int) string {
215 if s, ok := httpCodeStringCommon[code]; ok { 205 switch code {
216 return s 206 case 200:
207 return "200"
208 case 404:
209 return "404"
217 } 210 }
218 return strconv.Itoa(code) 211 return strconv.Itoa(code)
219} 212}
@@ -312,7 +305,7 @@ func mustUint31(v int32) uint32 {
312} 305}
313 306
314// bodyAllowedForStatus reports whether a given response status code 307// bodyAllowedForStatus reports whether a given response status code
315// permits a body. See RFC 2616, section 4.4. 308// permits a body. See RFC 7230, section 3.3.
316func bodyAllowedForStatus(status int) bool { 309func bodyAllowedForStatus(status int) bool {
317 switch { 310 switch {
318 case status >= 100 && status <= 199: 311 case status >= 100 && status <= 199: