From 9f5e1a1ec566a6271b6c10e6b47e00e14409ecff Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Tue, 28 Nov 2023 13:17:42 +0100 Subject: [PATCH] Fix cdn connection issue --- config.example.yml | 4 ++-- pkg/http/client.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config.example.yml b/config.example.yml index d10af00..b60da86 100644 --- a/config.example.yml +++ b/config.example.yml @@ -15,7 +15,7 @@ retries_until_failed: 5 # api failures until considered failed # misc configs enable_repair: true # BEWARE! THERE CAN ONLY BE 1 INSTANCE OF ZURG THAT SHOULD REPAIR YOUR TORRENTS retain_folder_name_extension: false # if true, zurg won't modify the filenames from real-debrid -retain_rd_torrent_name: false # if true, it will strictly follow RD API returned torrent name which should make this more compatible with rdt-client +retain_rd_torrent_name: false # if true, it will strictly follow RD API torrent name property w/c should make this more compatible with rdt-client on_library_update: | for arg in "$@" do @@ -24,7 +24,7 @@ on_library_update: | # network configs network_buffer_size: 1048576 # 1 MiB serve_from_rclone: false -force_ipv6: true +force_ipv6: false # preferred_hosts: # Run the script here https://github.com/debridmediamanager/real-debrid-network-test # - 20.download.real-debrid.com # - 21.download.real-debrid.com diff --git a/pkg/http/client.go b/pkg/http/client.go index 1c09359..699b99d 100644 --- a/pkg/http/client.go +++ b/pkg/http/client.go @@ -25,10 +25,10 @@ type HTTPClient struct { } func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) { - req.Close = true if r.config != nil && strings.Contains(req.Host, "download.real-debrid.") { prefHost := r.config.GetRandomPreferredHost() if prefHost != "" { + req.Host = prefHost req.URL.Host = prefHost } }