refactor: introduce factory for stdlib http transport (#413)
With this factory, we want to construct ourselves the TLS dialer so that we can use a dialer wrapper that always sets timeouts when reading, addressing https://github.com/ooni/probe/issues/1609. As a result, we cannot immediately replace the i/e/netx factory for creating a new HTTP transport, since the functions signatures are not directly compatible. Refactoring is part of https://github.com/ooni/probe/issues/1505.
This commit is contained in:
parent
f59e98fd05
commit
6895946a34
5 changed files with 115 additions and 3 deletions
|
|
@ -47,8 +47,13 @@ func NewHTTP3Transport(
|
|||
dialer QUICContextDialer, tlsConfig *tls.Config) HTTPTransport {
|
||||
return &http3Transport{
|
||||
child: &http3.RoundTripper{
|
||||
Dial: (&http3Dialer{dialer}).dial,
|
||||
TLSClientConfig: tlsConfig,
|
||||
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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue