Skip to content
This repository was archived by the owner on Oct 2, 2022. It is now read-only.

Commit 7b2d246

Browse files
author
Janos Pasztor
committed
0.9.7: Bugfixing validation
This release fixes a validation bug introduced in the previous version where TLS parameters were validated even if the URL didn't point to a `https://` URL.
1 parent eb3325e commit 7b2d246

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.9.7: Bugfixing validation
4+
5+
This release fixes a validation bug introduced in the previous version where TLS parameters were validated even if the URL didn't point to a `https://` URL.
6+
37
## 0.9.6: Configurable TLS support, unified logging
48

59
This release adds configurable TLS versions, ciphers, ECDH curves, as well as transitioning to the unified logging interface.

client.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,16 @@ func (c *ClientConfiguration) Validate() error {
346346
return err
347347
}
348348

349-
if err := c.TLSVersion.Validate(); err != nil {
350-
return fmt.Errorf("invalid TLS version (%w)", err)
351-
}
352-
if err := c.ECDHCurves.Validate(); err != nil {
353-
return fmt.Errorf("invalid curve algorithms (%w)", err)
354-
}
355-
if err := c.CipherSuites.Validate(); err != nil {
356-
return fmt.Errorf("invalid cipher suites (%w)", err)
349+
if strings.HasPrefix(c.URL, "https://") {
350+
if err := c.TLSVersion.Validate(); err != nil {
351+
return fmt.Errorf("invalid TLS version (%w)", err)
352+
}
353+
if err := c.ECDHCurves.Validate(); err != nil {
354+
return fmt.Errorf("invalid curve algorithms (%w)", err)
355+
}
356+
if err := c.CipherSuites.Validate(); err != nil {
357+
return fmt.Errorf("invalid cipher suites (%w)", err)
358+
}
357359
}
358360

359361
return c.validateClientCert()

0 commit comments

Comments
 (0)