Skip to content

Allow HTTP_PROXY settings to use username and password - #31

Merged
rubyjedi merged 2 commits into
masterfrom
proxy-auth-support
Jul 10, 2026
Merged

Allow HTTP_PROXY settings to use username and password#31
rubyjedi merged 2 commits into
masterfrom
proxy-auth-support

Conversation

@rubyjedi

Copy link
Copy Markdown
Owner

Supersedes #16 (whose source fork, nitidbit/soap4r, has since been
deleted, 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 log shows his original commit and email).

What this does

lib/soap/netHttpClient.rb's create_connection builds the
Net::HTTP proxy connection from @proxy.host/@proxy.port only,
dropping any username/password embedded in the proxy URL
(http://user:pass@host:port) on the floor. This passes
@proxy.user/@proxy.password through to Net::HTTP::Proxy(...),
which already accepts them.

Only affects the Net::HTTP fallback driver (used when neither
httpclient nor http-access2 are 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, calling create_connection
directly (it's private) since it only builds/configures a Net::HTTP
object with no real #start/connect call -- safe without a network
call 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:deep suite: 337 tests, 2622
assertions, 0 failures, 0 errors.

winstonwolff and others added 2 commits July 9, 2026 13:36
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
rubyjedi merged commit 7c19524 into master Jul 10, 2026
12 of 18 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants