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

@ -63,6 +63,9 @@ func TestHandlerWorkingAsIntended(t *testing.T) {
NewResolver: func() model.Resolver {
return netxlite.NewUnwrappedStdlibResolver()
},
NewTLSHandshaker: func() model.TLSHandshaker {
return netxlite.NewTLSHandshakerStdlib(model.DiscardLogger)
},
}
srv := httptest.NewServer(handler)
defer srv.Close()
@ -76,25 +79,37 @@ func TestHandlerWorkingAsIntended(t *testing.T) {
parseBody bool
}
expectations := []expectationSpec{{
name: "check for invalid method",
reqMethod: "GET",
respStatusCode: 400,
name: "check for invalid method",
reqMethod: "GET",
reqContentType: "",
reqBody: "",
respStatusCode: 400,
respContentType: "",
parseBody: false,
}, {
name: "check for invalid content-type",
reqMethod: "POST",
respStatusCode: 400,
name: "check for invalid content-type",
reqMethod: "POST",
reqContentType: "",
reqBody: "",
respStatusCode: 400,
respContentType: "",
parseBody: false,
}, {
name: "check for invalid request body",
reqMethod: "POST",
reqContentType: "application/json",
reqBody: "{",
respStatusCode: 400,
name: "check for invalid request body",
reqMethod: "POST",
reqContentType: "application/json",
reqBody: "{",
respStatusCode: 400,
respContentType: "",
parseBody: false,
}, {
name: "with measurement failure",
reqMethod: "POST",
reqContentType: "application/json",
reqBody: `{"http_request": "http://[::1]aaaa"}`,
respStatusCode: 400,
name: "with measurement failure",
reqMethod: "POST",
reqContentType: "application/json",
reqBody: `{"http_request": "http://[::1]aaaa"}`,
respStatusCode: 400,
respContentType: "",
parseBody: false,
}, {
name: "with reasonably good request",
reqMethod: "POST",