fix(indexers): PolishSource downloads (#837)

* test: dump req and res for torrent download

* chore: remove req res dump
This commit is contained in:
ze0s 2023-04-14 21:15:32 +02:00 committed by GitHub
parent 8487475e73
commit 969a9e7025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -332,16 +332,10 @@ func (r *Release) downloadTorrentFile(ctx context.Context) error {
return nil
}
jar, err := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
if err != nil {
return errors.Wrap(err, "could not create cookiejar")
}
customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
client := &http.Client{
Transport: customTransport,
Jar: jar,
Timeout: time.Second * 45,
}
@ -350,7 +344,15 @@ func (r *Release) downloadTorrentFile(ctx context.Context) error {
return errors.Wrap(err, "error downloading file")
}
req.Header.Set("User-Agent", "autobrr")
if r.RawCookie != "" {
jar, err := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
if err != nil {
return errors.Wrap(err, "could not create cookiejar")
}
client.Jar = jar
// set the cookie on the header instead of req.AddCookie
// since we have a raw cookie like "uid=10; pass=000"
req.Header.Set("Cookie", r.RawCookie)