Repository navigation
Conversation
Net::HTTP.new dropped the proxy address and port when the host matched p_no_proxy, but kept p_user and p_pass, so the request to the host still carried a Proxy-Authorization header. Clear them as well, as is already the case when the proxy comes from the environment. Reported-by: Claude (Anthropic) and Stephan Lipp (Ada Logics) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
670efaa to
f11486e
Compare
shioimm
left a comment
There was a problem hiding this comment.
The commit message says "the request to the host still carried a Proxy-Authorization header", and I'd like to confirm the situation in which this happens.
Proxy-Authorization is added only at L1742, and only when the connection is HTTPS and proxy? is true.
However, when the destination host matches p_no_proxy (so the proxy is not used for it), p_addr becomes nil at L1117.
Then @proxy_address is set to nil at L1122, and proxy? returns false.
Wouldn't the situation described in the commit message occur only when the caller explicitly runs http.proxy_address = ... on the same object (or something similar), so that proxy? returns true?
If that is the premise, I think the fix itself is reasonable, but is the commit message appropriate as written?
|
@shioimm Thanks for the review. The Proxy-Authorization header in question is added here: Lines 2492 to 2494 in ab56ebd I hadn't noticed the |
shioimm
left a comment
There was a problem hiding this comment.
Thanks, you're right. I missed the proxy_basic_auth call in request.
It adds Proxy-Authorization whenever proxy_user is set and the connection is not HTTPS, and it does not check proxy?. So the commit message is accurate as written. Sorry for the noise.
And I think checking proxy? in that condition would also prevent other cases where proxy_user is set but no proxy is used, for example Net::HTTP.new(host, port, nil, nil, 'user', 'pass'). So I think it is fine to add it to this PR.
Net::HTTP.new dropped the proxy address and port when the host matched p_no_proxy, but kept p_user and p_pass, so the request to the host still carried a Proxy-Authorization header. Clear them as well, as is already the case when the proxy comes from the environment.
Reported-by: Claude (Anthropic) and Stephan Lipp (Ada Logics)