mirror of
https://github.com/golang/go
synced 2024-09-15 22:20:06 +00:00
net/http: convert allowQuerySemicolonsInUse to atomic type
For #53821
Change-Id: I135783bd5472011f6a74d2f5ee34ce96ff49ad2b
GitHub-Last-Rev: 4da2d67ff3
GitHub-Pull-Request: golang/go#54863
Reviewed-on: https://go-review.googlesource.com/c/go/+/428336
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
parent
e509452727
commit
b244b89d56
|
@ -2905,12 +2905,12 @@ func (sh serverHandler) ServeHTTP(rw ResponseWriter, req *Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.URL != nil && strings.Contains(req.URL.RawQuery, ";") {
|
if req.URL != nil && strings.Contains(req.URL.RawQuery, ";") {
|
||||||
var allowQuerySemicolonsInUse int32
|
var allowQuerySemicolonsInUse atomic.Bool
|
||||||
req = req.WithContext(context.WithValue(req.Context(), silenceSemWarnContextKey, func() {
|
req = req.WithContext(context.WithValue(req.Context(), silenceSemWarnContextKey, func() {
|
||||||
atomic.StoreInt32(&allowQuerySemicolonsInUse, 1)
|
allowQuerySemicolonsInUse.Store(true)
|
||||||
}))
|
}))
|
||||||
defer func() {
|
defer func() {
|
||||||
if atomic.LoadInt32(&allowQuerySemicolonsInUse) == 0 {
|
if !allowQuerySemicolonsInUse.Load() {
|
||||||
sh.srv.logf("http: URL query contains semicolon, which is no longer a supported separator; parts of the query may be stripped when parsed; see golang.org/issue/25192")
|
sh.srv.logf("http: URL query contains semicolon, which is no longer a supported separator; parts of the query may be stripped when parsed; see golang.org/issue/25192")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in a new issue