diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2016-09-27 18:27:02 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2016-09-27 22:06:32 +0000 |
| commit | a73020f847b3cf8575250569ebefb02573d19224 (patch) | |
| tree | bfa9a6cac9ce924188221904712294b4eeea1fbf /src/net/http/http.go | |
| parent | 36c164ec9c8597ec3507bb4aa9390603e9d29f7a (diff) | |
| download | go-a73020f847b3cf8575250569ebefb02573d19224.tar.xz | |
net/http: add more IDNA2008 tests and fix some omissions
It wasn't lowercasing the string, folding widths, and putting strings
into NFC form. Do those.
Fixes #13835
Change-Id: Ia3de6159417cacec203b48e206e51d79f945df58
Reviewed-on: https://go-review.googlesource.com/29860
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Diffstat (limited to 'src/net/http/http.go')
| -rw-r--r-- | src/net/http/http.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/net/http/http.go b/src/net/http/http.go index b34ae41ec5..258efbb152 100644 --- a/src/net/http/http.go +++ b/src/net/http/http.go @@ -6,6 +6,7 @@ package http import ( "strings" + "unicode/utf8" "golang_org/x/net/lex/httplex" ) @@ -41,3 +42,12 @@ func removeEmptyPort(host string) string { func isNotToken(r rune) bool { return !httplex.IsTokenRune(r) } + +func isASCII(s string) bool { + for i := 0; i < len(s); i++ { + if s[i] >= utf8.RuneSelf { + return false + } + } + return true +} |
