Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions pkg/protocols/http/httpclientpool/clientpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,8 @@ import (
urlutil "github.com/projectdiscovery/utils/url"
)

var (
forceMaxRedirects int
)

// Init initializes the clientpool implementation
func Init(options *types.Options) error {
if options.ShouldFollowHTTPRedirects() {
forceMaxRedirects = options.MaxRedirects
}

return nil
}

Expand Down Expand Up @@ -221,15 +213,17 @@ func wrappedGet(options *types.Options, configuration *Configuration) (*retryabl
redirectFlow := configuration.RedirectFlow
maxRedirects := configuration.MaxRedirects

if forceMaxRedirects > 0 {
if options.ShouldFollowHTTPRedirects() {
// by default we enable general redirects following
switch {
case options.FollowHostRedirects:
redirectFlow = FollowSameHostRedirect
default:
redirectFlow = FollowAllRedirect
}
maxRedirects = forceMaxRedirects
if options.MaxRedirects > 0 {
maxRedirects = options.MaxRedirects
}
}
if options.DisableRedirects {
options.FollowRedirects = false
Expand Down
Loading