mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-06-05 17:24:24 -04:00
Don't use contexts in the request directly
This commit is contained in:
parent
5ce59468bf
commit
47136d878b
1 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -49,12 +50,12 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
||||||
basePath := filepath.Base(dstPath)
|
basePath := filepath.Base(dstPath)
|
||||||
|
|
||||||
for attempt := 1; attempt <= maxRetries; attempt++ {
|
for attempt := 1; attempt <= maxRetries; attempt++ {
|
||||||
req, err := http.NewRequest("GET", downloadURL, nil)
|
req := &http.Request{}
|
||||||
|
parsedURL, err := url.Parse(downloadURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
req.URL = parsedURL
|
||||||
req.Header.Set("User-Agent", "WiiUDownloader")
|
|
||||||
|
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue