api: human friendly error for TLS [GH-123]
This commit is contained in:
parent
c3a793ccdf
commit
d4155ef9d8
|
@ -3,6 +3,8 @@
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
|
||||||
* core: Very verbose error if mlock fails [GH-59]
|
* core: Very verbose error if mlock fails [GH-59]
|
||||||
|
* command/*: On error with TLS oversized record, show more human-friendly
|
||||||
|
error message. [GH-123]
|
||||||
* command/server: Add configuration option to disable mlock
|
* command/server: Add configuration option to disable mlock
|
||||||
* command/server: Disable mlock for dev mode so it works on more systems
|
* command/server: Disable mlock for dev mode so it works on more systems
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -170,9 +171,16 @@ START:
|
||||||
result = &Response{Response: resp}
|
result = &Response{Response: resp}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
urlErr, ok := err.(*url.Error)
|
if urlErr, ok := err.(*url.Error); ok && urlErr.Err == errRedirect {
|
||||||
if ok && urlErr.Err == errRedirect {
|
|
||||||
err = nil
|
err = nil
|
||||||
|
} else if strings.Contains(err.Error(), "tls: oversized") {
|
||||||
|
err = fmt.Errorf(
|
||||||
|
"%s\n\n"+
|
||||||
|
"This error usually means that the server is running with TLS disabled\n"+
|
||||||
|
"but the client is configured to use TLS. Please either enable TLS\n"+
|
||||||
|
"on the server, or run the client with -addr set to http://<addr>\n"+
|
||||||
|
"where <addr> is replaced by the actual address to the server.",
|
||||||
|
err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue