Allow HTTP_PROXY settings to use username and password - #31
Merged
Conversation
Winston's fix (previous commit) passes @Proxy's user/password through to Net::HTTP::Proxy(...), which the Net::HTTP fallback driver (lib/soap/netHttpClient.rb) previously dropped on the floor entirely. No existing test exercises this file at all: HTTPStreamHandler only falls back to NetHttpClient when both httpclient and http-access2 fail to load, and this project's Gemfile always requires httpclient, so nothing else in the suite ever reaches this code path. Added test/soap/test_nethttpclient.rb, calling create_connection directly (it's private, invoked via #send) since it just builds and configures a Net::HTTP object with no actual #start/connect call -- safe to test without a real network call or proxy server. Covers the credentialed case, the credential-less case (no regression), and the no-proxy-at-all case. Confirmed this fails on the exact credentialed-proxy assertion without Winston's fix, and passes cleanly with it. Co-Authored-By: Winston <winstonw@stratolab.com>
rubyjedi
added a commit
that referenced
this pull request
Jul 15, 2026
Adds HTTP_PROXY username/password support to the Net::HTTP fallback driver, superseding #16 (source fork deleted). Full credit to @winstonwolff for the original fix; cherry-picked with authorship preserved, plus a new regression test (test/soap/test_nethttpclient.rb) since this file previously had zero test coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Supersedes #16 (whose source fork,
nitidbit/soap4r, has since beendeleted, so it can no longer be updated or merged directly) -- full
credit to @winstonwolff for the original fix, cherry-picked here with
authorship preserved (
git logshows his original commit and email).What this does
lib/soap/netHttpClient.rb'screate_connectionbuilds theNet::HTTP proxy connection from
@proxy.host/@proxy.portonly,dropping any username/password embedded in the proxy URL
(
http://user:pass@host:port) on the floor. This passes@proxy.user/@proxy.passwordthrough toNet::HTTP::Proxy(...),which already accepts them.
Only affects the Net::HTTP fallback driver (used when neither
httpclientnorhttp-access2are available) -- the primary,recommended HTTPClient-based driver already supports authenticated
proxies natively via the same URL syntax, independent of this fix.
Testing
No existing test exercised this file at all, so I added
test/soap/test_nethttpclient.rb, callingcreate_connectiondirectly (it's private) since it only builds/configures a
Net::HTTPobject with no real
#start/connect call -- safe without a networkcall or proxy server. Covers: credentialed proxy, proxy without
credentials (no regression), and no proxy at all.
Confirmed the credentialed-proxy assertion fails without the fix and
passes with it. Full
rake test:deepsuite: 337 tests, 2622assertions, 0 failures, 0 errors.