mirror of
https://github.com/caddyserver/caddy.git
synced 2026-02-09 01:59:21 +08:00
caddytls: Check type assertion
Fix https://github.com/mholt/caddy-l4/issues/378
This commit is contained in:
@@ -502,8 +502,8 @@ func (t *TLSConfig) unmarshalCaddyfile(d *caddyfile.Dispenser) error {
|
|||||||
// If there is no custom TLS configuration, a nil config may be returned.
|
// If there is no custom TLS configuration, a nil config may be returned.
|
||||||
// copied from with minor modifications: modules/caddyhttp/reverseproxy/httptransport.go
|
// copied from with minor modifications: modules/caddyhttp/reverseproxy/httptransport.go
|
||||||
func (t *TLSConfig) makeTLSClientConfig(ctx caddy.Context) (*tls.Config, error) {
|
func (t *TLSConfig) makeTLSClientConfig(ctx caddy.Context) (*tls.Config, error) {
|
||||||
repl, _ := ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
|
repl, ok := ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer)
|
||||||
if repl == nil {
|
if !ok || repl == nil {
|
||||||
repl = caddy.NewReplacer()
|
repl = caddy.NewReplacer()
|
||||||
}
|
}
|
||||||
cfg := new(tls.Config)
|
cfg := new(tls.Config)
|
||||||
|
|||||||
Reference in New Issue
Block a user