Skip to content

Commit

Permalink
use resp.SkipBody in fasthttpjob
Browse files Browse the repository at this point in the history
  • Loading branch information
arriven committed Apr 17, 2022
1 parent 8012b6c commit 3147170
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/job/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,13 @@ func fastHTTPJob(ctx context.Context, args config.Args, globalConfig *GlobalConf
backoffController := utils.BackoffController{BackoffConfig: utils.NonNilOrDefault(jobConfig.Backoff, globalConfig.Backoff)}
client := http.NewClient(ctx, *clientConfig, logger)

req := fasthttp.AcquireRequest()
defer fasthttp.ReleaseRequest(req)
req, resp := fasthttp.AcquireRequest(), fasthttp.AcquireResponse()
defer func() {
fasthttp.ReleaseRequest(req)
fasthttp.ReleaseResponse(resp)
}()

resp.SkipBody = true

if !isInEncryptedContext(ctx) {
log.Printf("Attacking %v", jobConfig.Request["path"])
Expand All @@ -151,7 +156,7 @@ func fastHTTPJob(ctx context.Context, args config.Args, globalConfig *GlobalConf

http.InitRequest(requestConfig, req)

if err := sendFastHTTPRequest(client, req, nil); err != nil {
if err := sendFastHTTPRequest(client, req, resp); err != nil {
logger.Debug("error sending request", zap.Error(err), zap.Any("args", args))
a.Inc(target(req.URI()), metrics.RequestsAttemptedStat).Flush()
utils.Sleep(ctx, backoffController.Increment().GetTimeout())
Expand Down

0 comments on commit 3147170

Please sign in to comment.