diff options
| author | Shulhan <ms@kilabit.info> | 2024-12-13 12:02:44 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-01-02 03:14:16 +0700 |
| commit | 0933476ff61089bd5d846ebc48c4c9160302e802 (patch) | |
| tree | 2b72cb2fe43fabd58593ad70980f706298f5f54d /client.go | |
| parent | 9a5e753864629aedcb5d91b66459e3773c7f835a (diff) | |
| download | kbbi-0933476ff61089bd5d846ebc48c4c9160302e802.tar.xz | |
client: fix connection being blocked by CloudFlare
I think the admin of kbbi set the HTTPS mode minimal to version 1.3, which
cause Go (that use TLS v1.2 by default, but have 1.3 as maximum) being
rejected during handshake.
Diffstat (limited to 'client.go')
| -rw-r--r-- | client.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -5,6 +5,7 @@ package kbbi import ( "bytes" + "crypto/tls" "encoding/gob" "errors" "fmt" @@ -99,6 +100,10 @@ func NewClient() (cl *Client, err error) { } cl.httpc.Jar = jar + var transport *http.Transport = cl.httpc.Transport() + + // This fix connection being blocked by CloudFlare. + transport.TLSClientConfig.MinVersion = tls.VersionTLS13 err = cl.loadCookies() if err != nil { |
