diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/net/http/csrf.go | 4 | ||||
| -rw-r--r-- | src/net/http/server.go | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/net/http/csrf.go b/src/net/http/csrf.go index d088b9b615..0b71b40389 100644 --- a/src/net/http/csrf.go +++ b/src/net/http/csrf.go @@ -90,6 +90,10 @@ var sentinelHandler Handler = &noopHandler{} // would redirect to a pattern (e.g. after cleaning the path or adding a // trailing slash) are not. // +// AddInsecureBypassPattern panics if the pattern conflicts with one already +// registered, or if the pattern is syntactically invalid (for example, an +// improperly formed wildcard). +// // AddInsecureBypassPattern can be called concurrently with other methods or // request handling, and applies to future requests. func (c *CrossOriginProtection) AddInsecureBypassPattern(pattern string) { diff --git a/src/net/http/server.go b/src/net/http/server.go index 6fdcd51c0a..4078c89906 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -2868,8 +2868,10 @@ func (mux *ServeMux) ServeHTTP(w ResponseWriter, r *Request) { // always refers to user code. // Handle registers the handler for the given pattern. -// If the given pattern conflicts with one that is already registered, Handle -// panics. +// If the given pattern conflicts with one that is already registered +// or if the pattern is invalid, Handle panics. +// +// See [ServeMux] for details on valid patterns and conflict rules. func (mux *ServeMux) Handle(pattern string, handler Handler) { if use121 { mux.mux121.handle(pattern, handler) @@ -2879,8 +2881,10 @@ func (mux *ServeMux) Handle(pattern string, handler Handler) { } // HandleFunc registers the handler function for the given pattern. -// If the given pattern conflicts with one that is already registered, HandleFunc -// panics. +// If the given pattern conflicts with one that is already registered +// or if the pattern is invalid, HandleFunc panics. +// +// See [ServeMux] for details on valid patterns and conflict rules. func (mux *ServeMux) HandleFunc(pattern string, handler func(ResponseWriter, *Request)) { if use121 { mux.mux121.handleFunc(pattern, handler) |
