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

fix(tm2): make HTTPClient support https #1158

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Changes from 2 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
12 changes: 6 additions & 6 deletions tm2/pkg/bft/rpc/lib/client/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@
return "", "", fmt.Errorf("invalid addr: %s", remoteAddr)
}

// accept http(s) as an alias for tcp
switch protocol {
case protoHTTP, protoHTTPS:
protocol = protoTCP
}

return protocol, address, nil
}

Expand All @@ -99,6 +93,12 @@
return makeErrorDialer(err)
}

// net.Dial doesn't understand http/https, so change it to TCP
switch protocol {
case protoHTTP, protoHTTPS:
protocol = protoTCP

Check warning on line 99 in tm2/pkg/bft/rpc/lib/client/http_client.go

View check run for this annotation

Codecov / codecov/patch

tm2/pkg/bft/rpc/lib/client/http_client.go#L98-L99

Added lines #L98 - L99 were not covered by tests
}

return func(proto, addr string) (net.Conn, error) {
return net.Dial(protocol, address)
}
Expand Down
Loading