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

Advanced HTTP transport configuration #627

Merged
merged 30 commits into from
Nov 29, 2022
Merged

Advanced HTTP transport configuration #627

merged 30 commits into from
Nov 29, 2022

Conversation

Byron
Copy link
Owner

@Byron Byron commented Nov 24, 2022

Tasks

  • apply remote overrides (probably best via name of the remote)
  • Configure curl with all options available in http::Options
  • find a way to apply environment variables and have them override (all?) values,
    probably via git-config. Be aware of lower-case versions of these vars (for historical reasons) - set config overrides with special Source to set priorities later.
    • assure correct order of these overrides - CLI overrides are overriding everything right now which probably shouldn't be
    • http_proxy as fallback
    • HTTPS_PROXY, https_proxy as fallback
    • GIT_HTTP_LOW_SPEED_LIMIT, GIT_HTTP_LOW_SPEED_TIME, GIT_HTTP_USER_AGENT, GIT_HTTP_PROXY_AUTHMETHOD as overrides
    • no_proxy, NO_PROXY
    • ALL_PROXY, all_proxy
    • use gitoxide.https.proxy
    • GIT_CURL_VERBOSE
    • control accessibility of HTTP configuration env-vars via permission
    • sections known their ids so it's easier to remove them

For later

  • try to implement complex http.<url>.* based option overrides
  • use is-terminal instead of atty

Technically they can be any value (except for newlines and unescaped double quotes),
and these values might be paths and everything that comes with it, like
illformed UTF8. In order to be able to represent everything that
git can represent, we don't enforce UTF8 anymore for subsection names.

Note that section names and key names are required to be valid UTF8
(and even alphanumeric ascii), which makes illformed UTF8 very unlikely
there.
….origin.url"`, add `section_by_key("remote.origin")` as well.

That way it's the most comfortable way to query values and very
similar to how git does it, too.

Additionally, sections can be obtained by section key, both mutably and immutably for completeness.
…named after URLs.

`reference::remote::Name` was moved to `remote::Name` to represent all remote names without
necessarily having been validated.

Note that we also don't validate names anymore if read from configuration, but use it as is.
This means that remotes can be read and written back even with invalid names.
We should one day turn that back but then again, `gix` isn't outputting
vast amounts of data to stdout, and shouldn't, as in most modes it's
actually collected to memory first.

Hence optimal write performance to stdout/stderr shouldn't be our
priority here.
This comes with changes to the `HTTP` trait which now requires a base-url
to be provided as well.
…errides.

That way environment variables represented via git-configuration
can be integrated into git configuration, making clearer what's
going to happen even when looking at the configuration via
`gix config`.

The implementation has to be careful though about assureing there
is no more specific configuration key, like `http.<URL>.proxy` that
would override the one from the environment, which always has
the final word.
@Byron Byron force-pushed the http-config branch 2 times, most recently from 8642fdc to 907b5aa Compare November 27, 2022 08:46
…able with a comment.

This is useful for providing more information about a value at hand, especially if it was
added programmatically and then shows up in the configuration.
@Byron Byron force-pushed the http-config branch 4 times, most recently from 4a7eb40 to 5edd637 Compare November 29, 2022 06:19
That way it's possible to more easily interact with it later, for instance
when one wants to delete it.
…ethods usage in `&mut self`.

That way it's easier to configure both the `full` and the `partial` trust instances
of discovery options.
- use improved API in git-config
- expose `plumbing` directly via AsDeref.
This means different things depending on the backend, and for
`curl` it means a lot of debug-output on stderr.
@Byron Byron force-pushed the http-config branch 2 times, most recently from 1e14b41 to 446b770 Compare November 29, 2022 10:51
…hosts.

This is a curl-first option which can reasonably be implemented for other backends
as well and thus retains its curl-ish roots in full.
That way it's possible to deny using environment variables that affect
the HTTP transport, like setting the proxy.
Using git-configuration to store overrides from the environment
is helpful as it more tighly integrates with the best configuration
system there is, and also is nicely visualizable.

It's now done for transport related configuration as well as all
other environment variables we previously queried on the fly.
… git-configuration flags.

Now it's possible to map the environment variables `GIT_REPLACE_REF_BASE` and `GIT_NO_REPLACE_OBJECTS`
to custom git configuration keys which can also be set, namely `gitoxide.odb.replaceObjectsRefBase`
and `gitoxide.odb.noReplaceObjects`.

Along with the possibility of disabling the usage of `GIT_` prefixed environment variables one
reaches the previous level of control without making object replacement a special case.
… configuration.

That way it becomes more obvious where values are coming from.
…_MEMORY` in git-configuration.

That way there is a unified system for how to set values, which may be overridable by configuration
variables or not.

With this changes, the explicit application of environment variables for setting the cache
isn't required anymore as everything happens using git-configuration, and automatically,
while providing full control like before.
@Byron Byron merged commit 6b9632e into main Nov 29, 2022
@Byron Byron deleted the http-config branch November 29, 2022 20:58
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