Skip to content

Commit

Permalink
Merge pull request #8 from redhuntlabs/get-method-fix
Browse files Browse the repository at this point in the history
added client.get method instead of http.get
  • Loading branch information
0x4f53 committed Nov 12, 2023
2 parents 79dd988 + 74507ce commit fb589f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Binary file modified BucketLoot
Binary file not shown.
18 changes: 16 additions & 2 deletions scanfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ func scanS3FilesSlow(fileURLs []string, bucketURL string) error {
}
defer tempFile.Close()

client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
// You can customize redirect handling here if needed.
return nil
},
}

// Make HTTP request to S3 bucket
resp, err := http.Get(fileURL)
resp, err := client.Get(fileURL)
if err != nil {
errors = append(errors, fmt.Errorf("error making HTTP request to S3 bucket file URL: %v", err))
continue
Expand Down Expand Up @@ -259,7 +266,14 @@ func scanS3FilesFast(fileURLs []string, bucketURL string) error {
go func(url string) {
defer wg.Done()

resp, err := http.Get(url)
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
// You can customize redirect handling here if needed.
return nil
},
}

resp, err := client.Get(url)
if err != nil {
mutex.Lock()
errors = append(errors, fmt.Errorf("error making HTTP request to S3 bucket file URL: %v", err))
Expand Down

0 comments on commit fb589f4

Please sign in to comment.