Skip to content

Commit 0e21300

Browse files
committed
Fix #208 make sure that if the default http01 listener is closed and nil dont close it again
1 parent 09eeeb7 commit 0e21300

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

debug/debug_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
func StartPprof() {
1212
go func() {
1313
if config.Values.DevMode {
14-
log.Println("debug pprof server")
14+
log.Println("debug pprof server started on :6060")
1515
log.Println(http.ListenAndServe(":6060", nil))
1616
}
1717
}()

internal/autotls/certmagic.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,12 @@ func (a *AutoTLS) DynamicListener(forWhat data.Webserver, mux http.Handler) erro
119119
return fmt.Errorf("could not get initial web server config for %s: %w", forWhat, err)
120120
}
121121

122-
if _, port, err := net.SplitHostPort(initialDetails.ListenAddress); err == nil && port == "80" {
123-
log.Println("Shutdown default 80/tcp http listener in favor of: ", forWhat, "configuration.")
124-
a.http01Challenge.Close()
125-
a.http01Challenge = nil
122+
if a.http01Challenge != nil {
123+
if _, port, err := net.SplitHostPort(initialDetails.ListenAddress); err == nil && port == "80" {
124+
log.Println("Shutdown default 80/tcp http listener in favor of: ", forWhat, "configuration.")
125+
a.http01Challenge.Close()
126+
a.http01Challenge = nil
127+
}
126128
}
127129

128130
if err := a.refreshListeners(forWhat, mux, &initialDetails); err != nil {

0 commit comments

Comments
 (0)