]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: remove unused function
authorJonathan Amsterdam <jba@google.com>
Fri, 22 Sep 2023 20:11:36 +0000 (16:11 -0400)
committerJonathan Amsterdam <jba@google.com>
Mon, 25 Sep 2023 16:46:57 +0000 (16:46 +0000)
Change-Id: I4364d94663282249e632d12026a810147844ad2e
Reviewed-on: https://go-review.googlesource.com/c/go/+/530615
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/http/pattern.go
src/net/http/pattern_test.go

index 0c8644d9cdc5aa59e9b688ebe2029fb56fb3c00a..f6af19b0f4437f0011e50a69ac91eaf636d53257 100644 (file)
@@ -180,20 +180,6 @@ func parsePattern(s string) (_ *pattern, err error) {
        return p, nil
 }
 
-// TODO(jba): remove this; it is unused.
-func isValidHTTPToken(s string) bool {
-       if s == "" {
-               return false
-       }
-       // See https://www.rfc-editor.org/rfc/rfc9110#section-5.6.2.
-       for _, r := range s {
-               if !unicode.IsLetter(r) && !unicode.IsDigit(r) && !strings.ContainsRune("!#$%&'*+.^_`|~-", r) {
-                       return false
-               }
-       }
-       return true
-}
-
 func isValidWildcardName(s string) bool {
        if s == "" {
                return false
index b219648f332db5006bfa541b90e28223ebe815fb..f0c84d243ec96c547918de7c1faa312728e2292d 100644 (file)
@@ -145,26 +145,6 @@ func (p1 *pattern) equal(p2 *pattern) bool {
                slices.Equal(p1.segments, p2.segments)
 }
 
-func TestIsValidHTTPToken(t *testing.T) {
-       for _, test := range []struct {
-               in   string
-               want bool
-       }{
-               {"", false},
-               {"GET", true},
-               {"get", true},
-               {"white space", false},
-               {"#!~", true},
-               {"a-b1_2", true},
-               {"notok)", false},
-       } {
-               got := isValidHTTPToken(test.in)
-               if g, w := got, test.want; g != w {
-                       t.Errorf("%q: got %t, want %t", test.in, g, w)
-               }
-       }
-}
-
 func mustParsePattern(tb testing.TB, s string) *pattern {
        tb.Helper()
        p, err := parsePattern(s)