aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/http.go
diff options
context:
space:
mode:
authorJulien Cretel <jub0bsinthecloud@gmail.com>2025-02-17 18:39:58 +0000
committerGopher Robot <gobot@golang.org>2025-03-04 05:02:52 -0800
commitfd8938c799969ad8caec2aaec5a4966e48a17895 (patch)
tree0d59d8bd402772e8ef9e1087f6a31e14a4092cd8 /src/net/http/http.go
parent32fdcd7ca5156b2a0e928aa34a7b88f301ddc6f1 (diff)
downloadgo-fd8938c799969ad8caec2aaec5a4966e48a17895.tar.xz
net/http: speed up cookie and method validation
Fixes #67031 Change-Id: I1d764afdc7e50d61007f5f71a674eb6872ce507a GitHub-Last-Rev: 869535e843d2133fa5279297b002dd96725384e0 GitHub-Pull-Request: golang/go#71798 Reviewed-on: https://go-review.googlesource.com/c/go/+/650195 Auto-Submit: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/net/http/http.go')
-rw-r--r--src/net/http/http.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/net/http/http.go b/src/net/http/http.go
index e1e9eea0ce..0f9165bf03 100644
--- a/src/net/http/http.go
+++ b/src/net/http/http.go
@@ -123,6 +123,12 @@ func isNotToken(r rune) bool {
return !httpguts.IsTokenRune(r)
}
+// isToken reports whether v is a valid token (https://www.rfc-editor.org/rfc/rfc2616#section-2.2).
+func isToken(v string) bool {
+ // For historical reasons, this function is called ValidHeaderFieldName (see issue #67031).
+ return httpguts.ValidHeaderFieldName(v)
+}
+
// stringContainsCTLByte reports whether s contains any ASCII control character.
func stringContainsCTLByte(s string) bool {
for i := 0; i < len(s); i++ {