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
AWS SDK Compatibility: Check for http_proxy
& https_proxy
environment variables
#2991
Conversation
this brings us in line with many other AWS SDKs which check for these environment variables to modify client behavior. it does not change behavior if you've already been setting your web proxy explicitly, or in properties (the same as the java (and other) sdks). we do introduce this with two new methods in ClientConfig to not break any existing callers using the methods that are public. while all of our callers have been updated to properly check web proxy, and then if that's unset check the protocol being used and optionally call `GetHttpProxy`/`GetHttpsProxy` as needed. If we're okay with breaking ever IT MAY be worthwhile to break `GetWebProxy` by taking in the protocol, and then just having the one method to prevent any accidental mis-use, and to ensure everyone is using those environment variables. it's also important to note: <dotnet/runtime#31113> meaning a user will just get an error if they try to proxy to something that is using `HTTPS`. i figured just letting it error on construction is probably the 'safest' option. letting the user know that their setting isn't being respected, as opposed to just silently 'ignoring' it. this is also a decision we might want to change.
Thanks a lot for the PR, we're discussing internally what should be done for the other SDKs that don't support these environment variables (aws/aws-sdk#538 (comment)). |
sdk/src/Core/Amazon.Runtime/Pipeline/HttpHandler/_bcl/HttpWebRequestFactory.cs
Show resolved
Hide resolved
sdk/src/Core/Amazon.Runtime/Pipeline/HttpHandler/_bcl/HttpWebRequestFactory.cs
Show resolved
Hide resolved
Ensure we read explicitly configured proxies through code first, and then fallback to reading the proxy from environment variables. next add some tests with the recommended environment variable mocking test setup provided.
@Mythra Could you please have a look at review comments and help address these in order to proceed further. |
Hey @ashishdhingra yep, I saw the comments and will get to it, but it's also the holidays and I'm otherwise preoccupied at the moment. I'll get to it as soon as I can as it is really important I've been watching it like a hawk. Thanks! |
I've come back from holidays, and made the changes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for making the change and the PR!
Thanks again for the contribution, we really appreciate it! This will be included in the next SDK release (which should happen tomorrow). |
Description
this brings us in line with many other AWS SDKs which check for these environment variables to modify client behavior. it does not change behavior if you've already been setting your web proxy explicitly, or in properties (the same as the java (and other) sdks).
we do introduce this with two new methods in ClientConfig to not break any existing callers using the methods that are public. while all of our callers have been updated to properly check web proxy, and then if that's unset check the protocol being used and optionally call
GetHttpProxy
/GetHttpsProxy
as needed. If we're okay with breaking ever IT MAY be worthwhile to breakGetWebProxy
by taking in the protocol, and then just having the one method to prevent any accidental mis-use, and to ensure everyone is using those environment variables.it's also important to note:
dotnet/runtime#31113 meaning a user will just get an error if they try to proxy to something that is using
HTTPS
. i figured just letting it error on construction is probably the 'safest' option. letting the user know that their setting isn't being respected, as opposed to just silently 'ignoring' it. this is also a decision we might want to change.Motivation and Context
fixes #1977
Testing
Types of changes
Checklist
License