Support and propagate HTTP options for proxy, ssl. #5429
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Command line parameters for proxy, ssl root, ssl opt-in for self-signed certificates
See issue for long rationale #5423 SSL/proxy flexibility for corporate environment
This PR introduces ClientBuilderConfig in lib/wasix/src/http/client_builder.rs and corresponding CliClientBuilderConfig at lib/cli/src/config/env.rs.
These are the config options:
They are parsed from the command line, and passed around during runtime initialisation flow. When any HTTP request is made, ClientBuilderConfig::create_client_builder is the one producing ClientBuilder with necessary settings.
Every creation of reqwest::ClientBuilder anywhere in Wasmer codebase now goes through ClientBuilderConfig::create_builder.
Corporate environment case
SSL spoofing and seemingly insecure HTTP proxies are commonplace in large corporate environments. You just can't reach out to the big internet without a bit of customisation.
This PR allows that customisation from a command line, explicitly.
It also makes it easy to further tweaki the settings, should you need it. The options can be captured with clap:: annotations in CliClientBuilderConfig and the single central place for handling them is ClientBuilderConfig::create_client_builder.
Testing and coding style
I've updated the existing tests to account for the changes, and tried to adhere to the coding styles.
Any feedback, guidance, refactoring/naming suggestions are welcome! I'm not fussy about how this feature implemented, just really want to enable Wasmer for a possible corporate use.