fix(netxlite): http3 transport needs logging by default (#492)

Adapt other places where it was not using a logger to either choose
a reasonable logger or disable logging for backwards compat.

See https://github.com/ooni/probe/issues/1591
This commit is contained in:
Simone Basso 2021-09-08 20:49:01 +02:00 committed by GitHub
commit e68adec9a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 16 deletions

View file

@ -53,17 +53,20 @@ func (txp *http3Transport) CloseIdleConnections() {
// dialer argument MUST NOT be nil. If the tlsConfig argument is nil,
// then the code will use the default TLS configuration.
func NewHTTP3Transport(
dialer QUICDialer, tlsConfig *tls.Config) HTTPTransport {
return &http3Transport{
child: &http3.RoundTripper{
Dial: (&http3Dialer{dialer}).dial,
// The following (1) reduces the number of headers that Go will
// automatically send for us and (2) ensures that we always receive
// back the true headers, such as Content-Length. This change is
// functional to OONI's goal of observing the network.
DisableCompression: true,
TLSClientConfig: tlsConfig,
logger Logger, dialer QUICDialer, tlsConfig *tls.Config) HTTPTransport {
return &httpTransportLogger{
HTTPTransport: &http3Transport{
child: &http3.RoundTripper{
Dial: (&http3Dialer{dialer}).dial,
// The following (1) reduces the number of headers that Go will
// automatically send for us and (2) ensures that we always receive
// back the true headers, such as Content-Length. This change is
// functional to OONI's goal of observing the network.
DisableCompression: true,
TLSClientConfig: tlsConfig,
},
dialer: dialer,
},
dialer: dialer,
Logger: logger,
}
}