这是indexloc提供的服务,不要输入任何密码
Skip to content

Add -timeout flag for customizable HTTP Request timeouts #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 27, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ The only dependency of ffuf is Go 1.11. No dependencies outside of Go standard l
- master
- New
- New CLI flag: -ac to autocalibrate response size and word filters based on few preset URLs.
- New CLI flag: -timeout to specify custom timeouts for all HTTP requests.


- Changed

Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func main() {
flag.BoolVar(&conf.FollowRedirects, "r", false, "Follow redirects")
flag.BoolVar(&conf.AutoCalibration, "ac", false, "Automatically calibrate filtering options")
flag.IntVar(&conf.Threads, "t", 40, "Number of concurrent threads.")
flag.IntVar(&conf.Timeout, "timeout", 10, "HTTP request timeout in seconds.")
flag.BoolVar(&opts.showVersion, "V", false, "Show version information.")
flag.Parse()
if opts.showVersion {
Expand Down
2 changes: 2 additions & 0 deletions pkg/ffuf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Config struct {
StopOnAll bool
FollowRedirects bool
AutoCalibration bool
Timeout int
Delay optRange
Filters []FilterProvider
Matchers []FilterProvider
Expand Down Expand Up @@ -61,6 +62,7 @@ func NewConfig(ctx context.Context) Config {
conf.Filters = make([]FilterProvider, 0)
conf.Delay = optRange{0, 0, false, false}
conf.Extensions = make([]string, 0)
conf.Timeout = 10
conf.DirSearchCompat = false
return conf
}
3 changes: 1 addition & 2 deletions pkg/runner/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ type SimpleRunner struct {
func NewSimpleRunner(conf *ffuf.Config) ffuf.RunnerProvider {
var simplerunner SimpleRunner
simplerunner.config = conf

simplerunner.client = &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse },
Timeout: time.Duration(10 * time.Second),
Timeout: time.Duration(time.Duration(conf.Timeout) * time.Second),
Transport: &http.Transport{
Proxy: conf.ProxyURL,
MaxIdleConns: 1000,
Expand Down