HTTP load generator, ApacheBench (ab) replacement
Go
add feature: disable compression
Artem Andreenko5fd251f438bd
diff --git a/boom.go b/boom.goindex fe80c2e..f19a898 100644--- a/boom.go+++ b/boom.go@@ -24,7 +24,7 @@ import ("regexp""strings"- "github.com/rakyll/boom/boomer"+ "github.com/miolini/boom/boomer")var (@@ -34,7 +34,6 @@ var (flagAccept = flag.String("A", "", "")flagType = flag.String("T", "text/html", "")flagAuth = flag.String("a", "", "")- flagInsecure = flag.Bool("allow-insecure", false, "")flagOutput = flag.String("o", "", "")flagProxyAddr = flag.String("x", "", "")@@ -42,6 +41,9 @@ var (flagN = flag.Int("n", 200, "")flagQ = flag.Int("q", 0, "")flagT = flag.Int("t", 0, "")++ flagInsecure = flag.Bool("allow-insecure", false, "")+ flagDisableCompression = flag.Bool("disable-compression", false, ""))var usage = `Usage: boom [options...] <url>@@ -64,6 +66,7 @@ Options:-x HTTP Proxy address as host:port-allow-insecure Allow bad/expired TLS/SSL certificates.+ -disable-compression Disable compression`// Default DNS resolver.@@ -157,13 +160,14 @@ func main() {Password: password,OriginalHost: originalHost,},- N: n,- C: c,- Qps: q,- Timeout: t,- AllowInsecure: *flagInsecure,- Output: *flagOutput,- ProxyAddr: *flagProxyAddr}).Run()+ N: n,+ C: c,+ Qps: q,+ Timeout: t,+ AllowInsecure: *flagInsecure,+ DisableCompression: *flagDisableCompression,+ Output: *flagOutput,+ ProxyAddr: *flagProxyAddr}).Run()}// Replaces host with an IP and returns the provideddiff --git a/boomer/boomer.go b/boomer/boomer.goindex 51d5d94..fb5e76c 100644--- a/boomer/boomer.go+++ b/boomer/boomer.go@@ -70,6 +70,9 @@ type Boomer struct {// Option to allow insecure TLS/SSL certificates.AllowInsecure bool+ // Option to disable decompress response+ DisableCompression bool+// Output typeOutput stringdiff --git a/boomer/run.go b/boomer/run.goindex ee6c037..70a87a0 100644--- a/boomer/run.go+++ b/boomer/run.go@@ -36,7 +36,8 @@ func (b *Boomer) Run() {func (b *Boomer) worker(ch chan *http.Request) {host, _, _ := net.SplitHostPort(b.Req.OriginalHost)tr := &http.Transport{- TLSClientConfig: &tls.Config{InsecureSkipVerify: b.AllowInsecure, ServerName: host},+ TLSClientConfig: &tls.Config{InsecureSkipVerify: b.AllowInsecure, ServerName: host},+ DisableCompression: b.DisableCompression,}if b.ProxyAddr != "" {tr.Dial = func(network string, addr string) (conn net.Conn, err error) {