Commit ee754b4a authored by Matthew Holt's avatar Matthew Holt

Bug fixes

parent 5f72b743
...@@ -97,11 +97,24 @@ func ArrangeBindings(allConfigs []server.Config) (map[*net.TCPAddr][]server.Conf ...@@ -97,11 +97,24 @@ func ArrangeBindings(allConfigs []server.Config) (map[*net.TCPAddr][]server.Conf
// Group configs by bind address // Group configs by bind address
for _, conf := range allConfigs { for _, conf := range allConfigs {
addr, err := net.ResolveTCPAddr("tcp", conf.Address()) newAddr, err := net.ResolveTCPAddr("tcp", conf.Address())
if err != nil { if err != nil {
return addresses, errors.New("Could not serve " + conf.Address() + " - " + err.Error()) return addresses, errors.New("Could not serve " + conf.Address() + " - " + err.Error())
} }
// Make sure to compare the string representation of the address,
// not the pointer, since a new *TCPAddr is created each time.
var existing bool
for addr := range addresses {
if addr.String() == newAddr.String() {
addresses[addr] = append(addresses[addr], conf) addresses[addr] = append(addresses[addr], conf)
existing = true
break
}
}
if !existing {
addresses[newAddr] = append(addresses[newAddr], conf)
}
} }
// Don't allow HTTP and HTTPS to be served on the same address // Don't allow HTTP and HTTPS to be served on the same address
......
...@@ -268,7 +268,7 @@ func standardAddress(str string) (host, port string, err error) { ...@@ -268,7 +268,7 @@ func standardAddress(str string) (host, port string, err error) {
} }
host, port, err = net.SplitHostPort(str) host, port, err = net.SplitHostPort(str)
if err != nil { if err != nil && schemePort == "" {
host, port, err = net.SplitHostPort(str + ":") // tack on empty port host, port, err = net.SplitHostPort(str + ":") // tack on empty port
} }
if err != nil && schemePort != "" { if err != nil && schemePort != "" {
......
...@@ -14,10 +14,8 @@ func TLS(c *Controller) (middleware.Middleware, error) { ...@@ -14,10 +14,8 @@ func TLS(c *Controller) (middleware.Middleware, error) {
c.TLS.Enabled = true c.TLS.Enabled = true
if c.Port == "http" { if c.Port == "http" {
c.TLS.Enabled = false c.TLS.Enabled = false
log.Printf("Warning: TLS was disabled on host http://%s."+ log.Printf("Warning: TLS disabled for %s://%s. To force TLS over the plaintext HTTP port, "+
" Make sure you are specifying https://%s in your config (if you haven't already)."+ "specify port 80 explicitly (https://%s:80).", c.Port, c.Host, c.Host)
" If you meant to serve tls on port 80,"+
" specify port 80 in your config (https://%s:80).", c.Host, c.Host, c.Host)
} }
for c.Next() { for c.Next() {
......
...@@ -78,10 +78,11 @@ func main() { ...@@ -78,10 +78,11 @@ func main() {
}(s) }(s)
app.Servers = append(app.Servers, s) app.Servers = append(app.Servers, s)
}
// Show initialization output
if !app.Quiet { if !app.Quiet {
var checkedFdLimit bool var checkedFdLimit bool
for addr, configs := range addresses { for addr, configs := range addresses {
for _, conf := range configs { for _, conf := range configs {
// Print address of site // Print address of site
...@@ -109,8 +110,8 @@ func main() { ...@@ -109,8 +110,8 @@ func main() {
} }
} }
} }
}
// Wait for all listeners to stop
app.Wg.Wait() app.Wg.Wait()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment