aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-12-13 12:02:44 +0700
committerShulhan <ms@kilabit.info>2025-01-02 03:14:16 +0700
commit0933476ff61089bd5d846ebc48c4c9160302e802 (patch)
tree2b72cb2fe43fabd58593ad70980f706298f5f54d /client.go
parent9a5e753864629aedcb5d91b66459e3773c7f835a (diff)
downloadkbbi-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.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/client.go b/client.go
index a54f179..091ea87 100644
--- a/client.go
+++ b/client.go
@@ -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 {