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
Support additional headers for TLS proxies #742
Changes from 2 commits
4a09e0f
7e660c7
654a6a3
69d6167
3a9dba4
1dd844b
1e5a5eb
b415556
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,7 +88,7 @@ def env_proxy_tests(env) | |
connection = nil | ||
|
||
tests('connection.data[:proxy][:host]').returns('mysecureproxy') do | ||
connection = Excon.new('https://secret.com') | ||
connection = Excon.new('https://secret.com', :ssl_proxy_headers => {'x-proxy-id': 'abc123' }) | ||
connection.data[:proxy][:host] | ||
end | ||
|
||
|
@@ -100,6 +100,10 @@ def env_proxy_tests(env) | |
connection.data[:proxy][:scheme] | ||
end | ||
|
||
tests('connection.data[:proxy][:headers]').returns({ 'x-proxy-id': 'abc123' }) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests are good for ensuring the data mutation into proxy happens as expected (unless we decide not to do that). I think it would be great to also add a test toward the end of this file, where it uses the Does that make sense? What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep! always happy to write more tests 😁 I'll dig into that |
||
connection.data[:proxy][:headers] | ||
end | ||
|
||
tests('with disable_proxy set') do | ||
connection = nil | ||
|
||
|
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.
I think the approach of using a separate key of
ssl_proxy_headers
makes a lot of sense, especially as proxy is generally expected to be a string (though the code is tolerant of a hash, like you suggest, I doubt it gets used that way most of the time).That being said, if we are already using a separate key, I wonder if it might be simpler/cleaner if we just leave that key/value as it is (instead of translating it to be inside the proxy hash) and just read directly from it here when we are setting up the ssl socket?
Does that make sense? I certainly might be missing something, but on review it occurred to me that sort of "cutting out the middle person" here and going directly to the hash could keep things simpler coding wise and avoid any potential issues of the mutated proxy hash being interpreted incorrectly elsewhere.
What do you think?
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.
ah yes that makes total sense! I'll update in a bit