mirror of
https://github.com/golang/go
synced 2024-11-23 22:40:04 -07:00
net/http: convert allowQuerySemicolonsInUse to atomic type
Signed-off-by: cui fliter <imcusg@gmail.com> net/http: convert allowQuerySemicolonsInUse to atomic type Signed-off-by: cui fliter <imcusg@gmail.com>
This commit is contained in:
parent
535fe2b226
commit
4da2d67ff3
@ -2897,12 +2897,12 @@ func (sh serverHandler) ServeHTTP(rw ResponseWriter, req *Request) {
|
||||
}
|
||||
|
||||
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() {
|
||||
atomic.StoreInt32(&allowQuerySemicolonsInUse, 1)
|
||||
allowQuerySemicolonsInUse.Store(true)
|
||||
}))
|
||||
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")
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user