Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(netxlite): add flexible HTTP transport factory #1270

Merged
merged 7 commits into from
Sep 14, 2023
Merged

Conversation

bassosimone
Copy link
Contributor

@bassosimone bassosimone commented Sep 14, 2023

Now that we've clearly labeled and packaged technical debt, we can copy existing technical-debt-ridden code and modify it to obtain a flexible factory for creating HTTP transports, NewHTTPTransportWithOptions.

In particular, this factory uses sensible defaults for measuring and there are options that you can pass it to customize details such as the backend proxy that we previously unconditionally configured.

More in detail, this is a side-by-side comparison between new code's defaults and old code:

Setting Name httpquirks.go (old code) httpfactory.go (new code)
.Proxy nil nil
.MaxConnsPerHost 1 ooni/oohttp's default
.DisableCompression true true
.ForceAttemptHTTP2 true true

So, basically, the biggest change is that we've removed the limitation of the max number of connections per host being set to 1. In any case, the new code allows to configure each of these fields.

This factory will be the starting point for having custom network functions for the engine in line with ooni/probe#2531.

While there, acknowledge that NewHTTPClient contains technical debt because it does unconditionally disable cookies, to document that and move it inside of the proper file (httpquirks.go).

Now that we've clearly labeled and package technical debt, we can
copy existing technical-debt-ridden code and modify it to obtain a
flexible factory for creating HTTP transports.

In particular, this factory uses sensible defaults for measuring
and there are options that you can pass it to customize details
such as the backend proxy as well as other underlying behavior that
we previously unconditionally configured.

This factory will be the starting point for having custom network
functions for the engine in line with ooni/probe#2531.
Merge branch 'issue/2531' of github.com:ooni/probe-cli into issue/2531
@bassosimone bassosimone merged commit 4e2d006 into master Sep 14, 2023
8 checks passed
@bassosimone bassosimone deleted the issue/2531 branch September 14, 2023 16:20
Murphy-OrangeMud pushed a commit to Murphy-OrangeMud/probe-cli that referenced this pull request Feb 13, 2024
Now that we've clearly labeled and packaged technical debt, we can copy
existing technical-debt-ridden code and modify it to obtain a flexible
factory for creating HTTP transports, `NewHTTPTransportWithOptions`.

In particular, this factory uses sensible defaults for measuring and
there are options that you can pass it to customize details such as the
backend proxy that we previously unconditionally configured.

More in detail, this is a side-by-side comparison between new code's
defaults and old code:

| Setting Name | httpquirks.go (old code) | httpfactory.go (new code) |
| ------------------- | ------------------------ |
-------------------------- |
| .Proxy | nil | nil |
| .MaxConnsPerHost | 1 | ooni/oohttp's default |
| .DisableCompression | true | true |
| .ForceAttemptHTTP2 | true | true |

So, basically, the biggest change is that we've removed the limitation
of the max number of connections per host being set to 1. In any case,
the new code allows to configure each of these fields.

This factory will be the starting point for having custom network
functions for the engine in line with
ooni/probe#2531.

While there, acknowledge that `NewHTTPClient` contains technical debt
because it does unconditionally disable cookies, to document that and
move it inside of the proper file (`httpquirks.go`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant