fix(oohelperd): use throw-away HTTPClient, Dialer, Resolver (#833)

This diff modifies the implementation of oohelperd in the master branch
to always use throw-away HTTPClient, Dialer, and Resolver.

The rationale of this change is to ensure we're not hitting limits of the
HTTPClient regarding the max number of connections per host.

This issue is described at https://github.com/ooni/probe/issues/2182.

While there, it feels more correct to use throw-away Dialer and Resolver.

We have a different patch for the release/3.15 branch because of
netx-related refactorings: https://github.com/ooni/probe-cli/pull/832.
This commit is contained in:
Simone Basso 2022-07-05 18:41:35 +02:00 committed by GitHub
commit a4d17085f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 60 deletions

View file

@ -14,10 +14,10 @@ import (
// Handler implements the Web Connectivity test helper HTTP API.
type Handler struct {
Client model.HTTPClient
Dialer model.Dialer
MaxAcceptableBody int64
Resolver model.Resolver
NewClient func() model.HTTPClient
NewDialer func() model.Dialer
NewResolver func() model.Resolver
}
func (h Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) {