only use the resolved name if port was zero

This commit is contained in:
Darren Shepherd 2018-12-31 22:49:42 -07:00 committed by Rafael Breno
parent 01a7dd875d
commit 2dd69d18c6

View File

@ -241,8 +241,10 @@ func (s *server) Start(stayUp bool) error {
if err != nil {
return err
}
// Use the actual address as baseURL host. This handles the "0" port case.
s.config.BaseURL.Host = listener.Addr().String()
if _, port, err := net.SplitHostPort(s.config.Addr); err != nil || port == "0" {
// Use the actual address as baseURL host. This handles the "0" port case.
s.config.BaseURL.Host = listener.Addr().String()
}
if s.config.TLSConfig != nil {
return s.server.ServeTLS(listener, "", "") // Use certs from TLSConfig.
}