rakyll / hey

HTTP load generator, ApacheBench (ab) replacement
Apache License 2.0
18k stars 1.19k forks source link

Validate URL and protocol scheme. #193

Open younisshah opened 4 years ago

younisshah commented 4 years ago

This is the first time I'm contributing to open-source software.

Trying with google.com generates the following report:


Summary:
  Total:    0.0013 secs
  Slowest:  0.0000 secs
  Fastest:  0.0000 secs
  Average:   NaN secs
  Requests/sec: 155560.3088

Response time histogram:

Latency distribution:

Details (average, fastest, slowest):
  DNS+dialup:    NaN secs, 0.0000 secs, 0.0000 secs
  DNS-lookup:    NaN secs, 0.0000 secs, 0.0000 secs
  req write:     NaN secs, 0.0000 secs, 0.0000 secs
  resp wait:     NaN secs, 0.0000 secs, 0.0000 secs
  resp read:     NaN secs, 0.0000 secs, 0.0000 secs

Status code distribution:

Error distribution:
  [200] Get google.com: unsupported protocol scheme ""

Similar reports are generated for invalid URLs httpa://google.com.

This PR fixes NaNs in the reports.

Renamed cap to capacity. cap collides with the built-in cap function.

Tested on go1.13.6