Skip to content

Send HTTP proxy authentication for empty passwords - #50

Merged
romis2012 merged 1 commit into
romis2012:masterfrom
omrzk:fix/http-empty-password
Oct 27, 2026
Merged

romis2012 merged 1 commit into
romis2012:masterfrom
omrzk:fix/http-empty-password

Conversation

@omrzk

@omrzk omrzk commented Oct 27, 2026

Copy link
Copy Markdown

When an HTTP proxy authenticates a username with an empty password, Proxy.from_url("http://login:@proxy:port") silently omits Proxy-Authorization and the proxy rejects CONNECT with 407. The HTTP BasicAuth encoder already supports that credential pair, but the request builder tests the password's truthiness before using it.

Treat an explicitly empty password as configured when the username is present. Add a request-header regression and controls for ordinary passwords, absent passwords, and anonymous connections.

Validation on Python 3.12.3/Linux, using the repository's locked development dependencies:

  • The new empty-password case fails on unchanged master; four controls pass.
  • A local TCP proxy fixture receives no credentials and returns 407 on unchanged master; the patched public Proxy.from_url() path authenticates and exchanges tunnel bytes.
  • All 395 sync/async and v1/v2 tests pass, with 94% package coverage.
  • Full Ruff lint/format checks and Mypy (78 files) pass; git diff --check passes.

The TCP reproduction uses a local proxy fixture, without an external proxy service.

@romis2012
romis2012 merged commit 377d3b9 into romis2012:master Oct 27, 2026
7 checks passed
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.36%. Comparing base (b3259cf) to head (9e2778d).
⚠️ Report is 2 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   94.30%   94.36%   +0.06%     
==========================================
  Files          55       55              
  Lines        1562     1562              
==========================================
+ Hits         1473     1474       +1     
+ Misses         89       88       -1     
Flag Coverage Δ
unit 94.36% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants