truncate TLS x509 error
This commit is contained in:
parent
56fd74c8f4
commit
ea645e07b3
1 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
package scanner
|
||||
|
||||
import "net/http"
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
x509 "crypto/x509"
|
||||
)
|
||||
|
||||
func CheckHTTP200(ctx Context, url string) (bool, string) {
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
||||
|
@ -9,6 +13,10 @@ func CheckHTTP200(ctx Context, url string) (bool, string) {
|
|||
}
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
var tlsCertErr x509.CertificateInvalidError
|
||||
if errors.As(err, &tlsCertErr) {
|
||||
return false, "tls: failed to verify certificate: x509: CertificateInvalidError (details truncated)"
|
||||
}
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue