forked from TrueCloudLab/lego
Merge branch 'add-shttp-bind-fallback'
This commit is contained in:
commit
959cf005c7
2 changed files with 7 additions and 3 deletions
|
@ -125,9 +125,13 @@ func (s *simpleHTTPChallenge) startHTTPSServer(domain string, token string) (net
|
|||
}
|
||||
|
||||
tlsListener, err := tls.Listen("tcp", domain+port, tlsConf)
|
||||
if err != nil {
|
||||
// if the domain:port bind failed, fall back to :port bind and try that instead.
|
||||
tlsListener, err = tls.Listen("tcp", port, tlsConf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
jsonBytes, err := json.Marshal(challenge{Type: "simpleHttp", Token: token, TLS: true})
|
||||
if err != nil {
|
||||
|
|
|
@ -24,9 +24,9 @@ func TestSimpleHTTPNonRootBind(t *testing.T) {
|
|||
if err := solver.Solve(clientChallenge, "127.0.0.1"); err == nil {
|
||||
t.Error("BIND: Expected Solve to return an error but the error was nil.")
|
||||
} else {
|
||||
expectedError := "Could not start HTTPS server for challenge -> listen tcp 127.0.0.1:443: bind: permission denied"
|
||||
expectedError := "Could not start HTTPS server for challenge -> listen tcp :443: bind: permission denied"
|
||||
if err.Error() != expectedError {
|
||||
t.Errorf("Expected error %s but instead got %s", expectedError, err.Error())
|
||||
t.Errorf("Expected error \"%s\" but instead got \"%s\"", expectedError, err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue