read file fix

This commit is contained in:
Ben Sarmiento
2023-11-12 00:37:35 +01:00
parent d737c3cc89
commit fcbbff9ea2
3 changed files with 91 additions and 49 deletions

View File

@@ -22,7 +22,8 @@ type HTTPClient struct {
func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
if r.config != nil && strings.Contains(req.Host, "download.real-debrid.") {
if host := r.config.GetRandomPreferredHost(); host != "" {
prefHost := r.config.GetRandomPreferredHost()
if host := prefHost; host != "" {
req.Host = r.config.GetRandomPreferredHost()
}
}
@@ -56,7 +57,7 @@ func NewHTTPClient(token string, maxRetries int, c config.ConfigInterface) *HTTP
if resp.StatusCode == 429 {
return true
}
// no need to retry
// no need to retry)
return false
},
log: logutil.NewLogger().Named("client"),