mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
The context may have no replacer
This commit is contained in:
parent
21af88fefc
commit
7cf8376e63
1 changed files with 5 additions and 4 deletions
|
@ -50,12 +50,13 @@ func (MatchServerName) CaddyModule() caddy.ModuleInfo {
|
||||||
|
|
||||||
// Match matches hello based on SNI.
|
// Match matches hello based on SNI.
|
||||||
func (m MatchServerName) Match(hello *tls.ClientHelloInfo) bool {
|
func (m MatchServerName) Match(hello *tls.ClientHelloInfo) bool {
|
||||||
|
repl := caddy.NewReplacer()
|
||||||
// caddytls.TestServerNameMatcher calls this function without any context
|
// caddytls.TestServerNameMatcher calls this function without any context
|
||||||
var repl *caddy.Replacer
|
|
||||||
if ctx := hello.Context(); ctx != nil {
|
if ctx := hello.Context(); ctx != nil {
|
||||||
repl = ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
|
// In some situations the existing context may have no replacer
|
||||||
} else {
|
if replAny := ctx.Value(caddy.ReplacerCtxKey); replAny != nil {
|
||||||
repl = caddy.NewReplacer()
|
repl = replAny.(*caddy.Replacer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, name := range m {
|
for _, name := range m {
|
||||||
|
|
Loading…
Reference in a new issue