Repository navigation
feat: honor http_proxy environment variables - #1111
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1111 +/- ##
==========================================
- Coverage 82.68% 82.56% -0.13%
==========================================
Files 53 53
Lines 7930 7942 +12
Branches 1240 1246 +6
==========================================
Hits 6557 6557
- Misses 1263 1270 +7
- Partials 110 115 +5 |
| if (options->read_proxy_from_environment) { | ||
| sentry__set_proxy_from_environment(options); | ||
| } |
There was a problem hiding this comment.
With this new option, I'm not sure we still need to support no_proxy; if users want to use the environment variable value in their own code, they can just not set this flag to true (which is the default anyway).
There was a problem hiding this comment.
Yes and no. You always have to consider that this is a feature that the users of our users require from them.
So, for instance, if your application ignores the http_proxy env-vars, your users don't care about the topic and accept that they have to manually configure the proxy config for that application (or even have no proxy config at all).
At some point, you might provide a UI to your users that does something like the following:
( ) direct HTTP connection.
( ) manually specify HTTP proxy: _________ .
( * ) read proxy from the environment.
You can route this directly to our proposed options interface. However, once your users have configured the app to read from the environment, they will want to stay with it because it allows them to have a centrally managed proxy configuration rather than defining it separately in every application.
This is where no_proxy enters the picture. So, yes, resetting the proxy config of that app solves the problem, but then the users of our users are essentially back to square 1. Again, this is not a requirement for an initial implementation of that feature but a likely follow-up.
|
Also, now that we test whether the proxy actually gets used when we prompt it to, this crashpad socks5-proxy test fails on macOS (see runner output). It seems like the proxy isn't used, but when trying this with a non-localhost DSN it seems to work (similar to the remaining Windows failures)). |
- wrong bc of localhost-to-localhost proxy ignore in macOS
JoshuaMoelans
left a comment
There was a problem hiding this comment.
Almost there, just a few remarks left.
* read http_proxy from env. variable * add proxy read from env option * update CHANGELOG.md * Add proxy-from-env command + fix order of init * reorder https->http proxy fetching * add proxy_auth tests * fix CHANGELOG.md * fix CHANGELOG.md * fix test to avoid cmake build failed * add WinHTTP proxy username and password PoC * remove double set_proxy_credentials call * fix typos and some mem cleaning * add docs * user + test 'sentry__url_parse' for proxy auth * cleanup * add first proxy from environment test * add IPv6 proxy from env test * proxy-from-env cleanup * rework integration tests structure * add tests * move crashpad test & reusable start_mitmdump * test cleanup * fix null-string passing * clean up os.environ * add check if request was proxied * fix uninitialized proxy_url * add proxy_env finally check/cleanup function * extract proxy test cleanup/check function * fix proxy_test_finally + update CHANGELOG.md * add assert functions * add all-platform crashpad proxy from env reading * fix crashpad proxy-from-env test * read proxy from env winHTTP transport * add non-localhost hostname set/check/usage * fix CI to be platform specific * third time's the charm * replace the netloc replace with a string replace * remove accidental proxy host for non-proxy test * add ignore Curl_getaddrinfo_ex to leaks.txt * refactor proxy tests * remove incorrect 'fallback' logic comments + update CONTRIBUTING.md - wrong bc of localhost-to-localhost proxy ignore in macOS * add `http_proxy` reading * update CHANGELOG.md * read is_secure from dsn * cleaner proxy reading * check null dsn * add tests * change env clean order * update crashpad to handle empty linux proxy * forgot ; * linux fix with no_proxy + revert crashpad * return to <empty> proxy workaround for Linux crashpad transport * strcmp * pointer check * update CONTRIBUTING.md
Fixes #787
Overview
This started as an additional option to configure, but testing revealed that (some) transports already honor the variable. This PR is now mainly an extensive testing effort to reason about the boundaries & quirks of
http_proxy.One major addition was made to the crashpad handler which now also reads the environment variable if it was set.
TODO
Done
add optionremoved it in favor of relying on transportshttp_proxyenvironment variables sentry-docs#12424)options->proxyto "")