progress tracker fix

This commit is contained in:
Mzack9999 2020-07-21 20:51:58 +02:00
parent b4aabf4b34
commit eee452a8cd
2 changed files with 11 additions and 10 deletions

View File

@ -101,6 +101,8 @@ func (e *HTTPExecuter) ExecuteHTTP(URL string) (result Result) {
result.Extractions = make(map[string]interface{}) result.Extractions = make(map[string]interface{})
dynamicvalues := make(map[string]interface{}) dynamicvalues := make(map[string]interface{})
e.bulkHttpRequest.Reset()
for e.bulkHttpRequest.Next() && !result.Done { for e.bulkHttpRequest.Next() && !result.Done {
httpRequest, err := e.bulkHttpRequest.MakeHTTPRequest(URL, dynamicvalues, e.bulkHttpRequest.Current()) httpRequest, err := e.bulkHttpRequest.MakeHTTPRequest(URL, dynamicvalues, e.bulkHttpRequest.Current())
if err != nil { if err != nil {
@ -134,7 +136,6 @@ func (e *HTTPExecuter) handleHTTP(URL string, request *requests.HttpRequest, dyn
} }
fmt.Fprintf(os.Stderr, "%s", string(dumpedRequest)) fmt.Fprintf(os.Stderr, "%s", string(dumpedRequest))
} }
resp, err := e.httpClient.Do(req) resp, err := e.httpClient.Do(req)
if err != nil { if err != nil {
if resp != nil { if resp != nil {

View File

@ -377,7 +377,7 @@ func (r *BulkHTTPRequest) Reset() {
r.positionRaw = 0 r.positionRaw = 0
} }
func (r *BulkHTTPRequest) Current() string { func (r *BulkHTTPRequest) Current() string {
if r.positionPath <= len(r.Path) && len(r.Path) != 0 && r.positionRaw == 0 { if r.positionPath < len(r.Path) && len(r.Path) != 0 {
return r.Path[r.positionPath] return r.Path[r.positionPath]
} }
@ -387,16 +387,16 @@ func (r *BulkHTTPRequest) Total() int {
return len(r.Path) + len(r.Raw) return len(r.Path) + len(r.Raw)
} }
func (r *BulkHTTPRequest) Increment() int { func (r *BulkHTTPRequest) Increment() {
if r.positionPath <= len(r.Path) && len(r.Path) != 0 && r.positionRaw == 0 { if len(r.Path) > 0 && r.positionPath < len(r.Path) {
r.positionPath++ r.positionPath++
return r.positionPath return
} }
// if we have payloads increment only when the generators are done if len(r.Raw) > 0 && r.positionRaw < len(r.Raw) {
if r.generator == nil { // if we have payloads increment only when the generators are done
r.positionRaw++ if r.generator == nil {
r.positionRaw++
}
} }
return r.positionPath + r.positionRaw
} }