Commit 253d7f04 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: better comment in hasToken

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6249065
parent 2d1fa089
......@@ -99,6 +99,11 @@ func hasToken(v, token string) bool {
}
for sp := 0; sp <= len(v)-len(token); sp++ {
// Check that first character is good.
// The token is ASCII, so checking only a single byte
// is sufficient. We skip this potential starting
// position if both the first byte and its potential
// ASCII uppercase equivalent (b|0x20) don't match.
// False positives ('^' => '~') are caught by EqualFold.
if b := v[sp]; b != token[0] && b|0x20 != token[0] {
continue
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment