mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-27 06:03:48 +03:00
parent
4b1a9b6cc1
commit
0e829bc418
2 changed files with 9 additions and 9 deletions
|
@ -183,14 +183,14 @@ func (na NetworkAddress) listen(ctx context.Context, portOffset uint, config net
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ln == nil {
|
|
||||||
return nil, fmt.Errorf("unsupported network type: %s", na.Network)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ln == nil {
|
||||||
|
return nil, fmt.Errorf("unsupported network type: %s", na.Network)
|
||||||
|
}
|
||||||
|
|
||||||
if IsUnixNetwork(na.Network) {
|
if IsUnixNetwork(na.Network) {
|
||||||
isAbstractUnixSocket := strings.HasPrefix(address, "@")
|
isAbstractUnixSocket := strings.HasPrefix(address, "@")
|
||||||
if !isAbstractUnixSocket {
|
if !isAbstractUnixSocket {
|
||||||
|
|
|
@ -535,11 +535,6 @@ func (app *App) Start() error {
|
||||||
return fmt.Errorf("network '%s' cannot handle HTTP/1 or HTTP/2 connections", listenAddr.Network)
|
return fmt.Errorf("network '%s' cannot handle HTTP/1 or HTTP/2 connections", listenAddr.Network)
|
||||||
}
|
}
|
||||||
|
|
||||||
if useTLS {
|
|
||||||
// create TLS listener - this enables and terminates TLS
|
|
||||||
ln = tls.NewListener(ln, tlsCfg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// wrap listener before TLS (up to the TLS placeholder wrapper)
|
// wrap listener before TLS (up to the TLS placeholder wrapper)
|
||||||
var lnWrapperIdx int
|
var lnWrapperIdx int
|
||||||
for i, lnWrapper := range srv.listenerWrappers {
|
for i, lnWrapper := range srv.listenerWrappers {
|
||||||
|
@ -550,6 +545,11 @@ func (app *App) Start() error {
|
||||||
ln = lnWrapper.WrapListener(ln)
|
ln = lnWrapper.WrapListener(ln)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if useTLS {
|
||||||
|
// create TLS listener - this enables and terminates TLS
|
||||||
|
ln = tls.NewListener(ln, tlsCfg)
|
||||||
|
}
|
||||||
|
|
||||||
// finish wrapping listener where we left off before TLS
|
// finish wrapping listener where we left off before TLS
|
||||||
for i := lnWrapperIdx; i < len(srv.listenerWrappers); i++ {
|
for i := lnWrapperIdx; i < len(srv.listenerWrappers); i++ {
|
||||||
ln = srv.listenerWrappers[i].WrapListener(ln)
|
ln = srv.listenerWrappers[i].WrapListener(ln)
|
||||||
|
|
Loading…
Reference in a new issue