From 5f8c83adf269f12d383dbd3a0908765e562afce5 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Fri, 17 Feb 2023 11:16:40 -0800 Subject: [PATCH] fixed: handle tls.CertificateVerificationError --- maniphttp/manipulator.go | 2 +- maniphttp/manipulator_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/maniphttp/manipulator.go b/maniphttp/manipulator.go index ffce9970..b994604f 100644 --- a/maniphttp/manipulator.go +++ b/maniphttp/manipulator.go @@ -732,7 +732,7 @@ func (s *httpManipulator) send( goto RETRY - case x509.UnknownAuthorityError, x509.CertificateInvalidError, x509.HostnameError: + case x509.UnknownAuthorityError, x509.CertificateInvalidError, x509.HostnameError, x509.InsecureAlgorithmError, *tls.CertificateVerificationError: return nil, manipulate.ErrTLS{Err: err} default: diff --git a/maniphttp/manipulator_test.go b/maniphttp/manipulator_test.go index d7d735b9..5e1596a7 100644 --- a/maniphttp/manipulator_test.go +++ b/maniphttp/manipulator_test.go @@ -1152,7 +1152,7 @@ func TestHTTP_send(t *testing.T) { So(err, ShouldNotBeNil) So(err, ShouldHaveSameTypeAs, manipulate.ErrTLS{}) - So(err.Error(), ShouldEqual, fmt.Sprintf(`TLS error: Post "%s": x509: certificate signed by unknown authority`, ts.URL)) + So(err.Error(), ShouldEqual, fmt.Sprintf(`TLS error: Post "%s": tls: failed to verify certificate: x509: certificate signed by unknown authority`, ts.URL)) So(resp, ShouldBeNil) })