feat(oohelperd): measure TLS for :443 endpoints (#886)

This diff improves oohelperd to measure :443 endpoints with TLS.

Part of https://github.com/ooni/probe/issues/2237.
This commit is contained in:
Simone Basso 2022-08-28 14:34:40 +02:00 committed by GitHub
commit 1e7384d1cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 143 additions and 35 deletions

View file

@ -18,6 +18,9 @@ import (
"github.com/ooni/probe-cli/v3/internal/tracex"
)
// TODO(bassosimone): we should refactor the TH to use step-by-step such that we
// can use an existing connection for the HTTP-measuring task
// ctrlHTTPResponse is the result of the HTTP check performed by
// the Web Connectivity test helper.
type ctrlHTTPResponse = webconnectivity.ControlHTTPRequestResult
@ -51,11 +54,13 @@ func httpDo(ctx context.Context, config *httpConfig) {
defer config.Wg.Done()
req, err := http.NewRequestWithContext(ctx, "GET", config.URL, nil)
if err != nil {
config.Out <- ctrlHTTPResponse{ // fix: emit -1 like the old test helper does
// fix: emit -1 like the old test helper does
config.Out <- ctrlHTTPResponse{
BodyLength: -1,
Failure: httpMapFailure(err),
StatusCode: -1,
Title: "",
Headers: map[string]string{},
StatusCode: -1,
}
return
}
@ -73,11 +78,13 @@ func httpDo(ctx context.Context, config *httpConfig) {
defer clnt.CloseIdleConnections()
resp, err := clnt.Do(req)
if err != nil {
config.Out <- ctrlHTTPResponse{ // fix: emit -1 like old test helper does
// fix: emit -1 like the old test helper does
config.Out <- ctrlHTTPResponse{
BodyLength: -1,
Failure: httpMapFailure(err),
StatusCode: -1,
Title: "",
Headers: map[string]string{},
StatusCode: -1,
}
return
}