Skip to content
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

Verify TLS and add -k to disable #263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions hey.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ var (
t = flag.Int("t", 20, "")
z = flag.Duration("z", 0, "")

k = flag.Bool("k", false, "")
h2 = flag.Bool("h2", false, "")
cpus = flag.Int("cpus", runtime.GOMAXPROCS(-1), "")

Expand Down Expand Up @@ -91,6 +92,7 @@ Options:
-U User-Agent, defaults to version "hey/0.0.1".
-a Basic authentication, username:password.
-x HTTP Proxy address as host:port.
-k Allow insecure server connections when using SSL.
-h2 Enable HTTP/2.

-host HTTP Host header.
Expand Down Expand Up @@ -232,6 +234,7 @@ func main() {
DisableKeepAlives: *disableKeepAlives,
DisableRedirects: *disableRedirects,
H2: *h2,
K: *k,
ProxyAddr: proxyURL,
Output: *output,
}
Expand Down
5 changes: 4 additions & 1 deletion requester/requester.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ type Work struct {
// C is the concurrency level, the number of concurrent workers to run.
C int

// K is an option to allow insecure server connections when using SSL.
K bool

// H2 is an option to make HTTP/2 requests
H2 bool

Expand Down Expand Up @@ -237,7 +240,7 @@ func (b *Work) runWorkers() {

tr := &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: b.K,
ServerName: b.Request.Host,
},
MaxIdleConnsPerHost: min(b.C, maxIdleConn),
Expand Down