Skip to content

Conversation

@GLeurquin
Copy link
Contributor

@GLeurquin GLeurquin commented Dec 1, 2025

What do these changes do?

Pass proxy headers when re-using a connection from the pool. This prevents 407 error codes when a connection is reused with a proxy using HTTP (there is no issue with HTTPS).

Are there changes in behavior for the user?

Reusing connections with a proxy will now always pass proxy headers for HTTP calls

Is it a substantial burden for the maintainers to support this?

No

Related issue number

Fixes #2596

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES/ folder

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Dec 1, 2025
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.74%. Comparing base (bffff8c) to head (6cf3d38).
⚠️ Report is 6 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11777      +/-   ##
==========================================
- Coverage   98.74%   98.74%   -0.01%     
==========================================
  Files         127      127              
  Lines       43845    43879      +34     
  Branches     2332     2337       +5     
==========================================
+ Hits        43295    43327      +32     
- Misses        389      392       +3     
+ Partials      161      160       -1     
Flag Coverage Δ
CI-GHA 98.60% <100.00%> (-0.01%) ⬇️
OS-Linux 98.34% <100.00%> (-0.01%) ⬇️
OS-Windows 96.68% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.57% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.11% <100.00%> (-0.01%) ⬇️
Py-3.10.19 97.60% <100.00%> (+<0.01%) ⬆️
Py-3.11.14 97.80% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 97.31% <100.00%> (+<0.01%) ⬆️
Py-3.12.10 97.42% <100.00%> (+<0.01%) ⬆️
Py-3.12.12 97.91% <100.00%> (-0.01%) ⬇️
Py-3.13.9 98.16% <100.00%> (+<0.01%) ⬆️
Py-3.14.0 98.11% <100.00%> (-0.01%) ⬇️
Py-3.14.1t 97.18% <100.00%> (+<0.01%) ⬆️
Py-pypy3.11.13-7.3.20 97.40% <100.00%> (+<0.01%) ⬆️
VM-macos 97.57% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 98.34% <100.00%> (-0.01%) ⬇️
VM-windows 96.68% <100.00%> (+<0.01%) ⬆️

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

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

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 1, 2025

CodSpeed Performance Report

Merging #11777 will not alter performance

Comparing GLeurquin:fix/2596 (6cf3d38) with master (bffff8c)1

Summary

✅ 59 untouched

Footnotes

  1. No successful run was found on master (4db0b67) during the generation of this report, so bffff8c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@GLeurquin GLeurquin force-pushed the fix/2596 branch 3 times, most recently from 41a1fc8 to dba65ab Compare December 2, 2025 08:14
@webknjaz webknjaz requested a review from bdraco December 3, 2025 16:53
@GLeurquin
Copy link
Contributor Author

GLeurquin commented Dec 4, 2025

Thanks for the feedback, I took all your comments into account. I changed the tests with a state variable to make them easier to understand, created a helper function to centralize proxy request creation, and dealt with the case when having to wait for a connection to become available. I also use this helper function when creating a proxy connection, to avoid code duplication.

Tests are now failing for macos though, and I don't quite understand why (I don't have a mac to reproduce the issue), any help to fix that one would be appreciated.

@bdraco
Copy link
Member

bdraco commented Dec 4, 2025

Test failure looks like a transient timing issue.

I restarted the CI.

About to take off for the states so I'll try to look late late tonight if we land on time or tomorrow between meetings

@bdraco bdraco added backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot labels Dec 4, 2025
@bdraco
Copy link
Member

bdraco commented Dec 4, 2025

Looks like we made it past the MacOS failure but hit a real issue.

@GLeurquin
Copy link
Contributor Author

Looks like we made it past the MacOS failure but hit a real issue.

Could you explain which command to use to run tests for python 3.14 ? I don't see anything in the makefile and all the attempts I made to run it in python 3.14 resulted in errors or segmentation faults :/ That way I'll try to reproduce the issue and figure out where it comes from.. Or if you know where the issue comes from already let me know.

@Dreamsorcerer
Copy link
Member

Ignore that error. That's an issue with blockbuster on Python 3.14.1t. I'll figure out a workaround shortly if that library doesn't fix it.

@Dreamsorcerer
Copy link
Member

Resolved

@GLeurquin
Copy link
Contributor Author

Alright thanks for your support, anything else you need to merge this?

@bdraco
Copy link
Member

bdraco commented Dec 5, 2025

Needs a small cleanup to the change log message. I'll take care of it

@bdraco
Copy link
Member

bdraco commented Dec 5, 2025

Screenshot 2025-12-05 at 10 05 10 AM

@Dreamsorcerer Dreamsorcerer merged commit 7bbf17d into aio-libs:master Dec 9, 2025
41 checks passed
@patchback
Copy link
Contributor

patchback bot commented Dec 9, 2025

Backport to 3.13: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 7bbf17d on top of patchback/backports/3.13/7bbf17d09d5f87b93022d340e39d53f386d5d485/pr-11777

Backporting merged PR #11777 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.13/7bbf17d09d5f87b93022d340e39d53f386d5d485/pr-11777 upstream/3.13
  4. Now, cherry-pick PR fix(connector): propagate proxy headers on connection reuse #11777 contents into that branch:
    $ git cherry-pick -x 7bbf17d09d5f87b93022d340e39d53f386d5d485
    If it'll yell at you with something like fatal: Commit 7bbf17d09d5f87b93022d340e39d53f386d5d485 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 7bbf17d09d5f87b93022d340e39d53f386d5d485
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR fix(connector): propagate proxy headers on connection reuse #11777 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.13/7bbf17d09d5f87b93022d340e39d53f386d5d485/pr-11777
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback
Copy link
Contributor

patchback bot commented Dec 9, 2025

Backport to 3.14: 💔 cherry-picking failed — conflicts found

❌ Failed to cleanly apply 7bbf17d on top of patchback/backports/3.14/7bbf17d09d5f87b93022d340e39d53f386d5d485/pr-11777

Backporting merged PR #11777 into master

  1. Ensure you have a local repo clone of your fork. Unless you cloned it
    from the upstream, this would be your origin remote.
  2. Make sure you have an upstream repo added as a remote too. In these
    instructions you'll refer to it by the name upstream. If you don't
    have it, here's how you can add it:
    $ git remote add upstream https://github.com/aio-libs/aiohttp.git
  3. Ensure you have the latest copy of upstream and prepare a branch
    that will hold the backported code:
    $ git fetch upstream
    $ git checkout -b patchback/backports/3.14/7bbf17d09d5f87b93022d340e39d53f386d5d485/pr-11777 upstream/3.14
  4. Now, cherry-pick PR fix(connector): propagate proxy headers on connection reuse #11777 contents into that branch:
    $ git cherry-pick -x 7bbf17d09d5f87b93022d340e39d53f386d5d485
    If it'll yell at you with something like fatal: Commit 7bbf17d09d5f87b93022d340e39d53f386d5d485 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x 7bbf17d09d5f87b93022d340e39d53f386d5d485
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR fix(connector): propagate proxy headers on connection reuse #11777 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.14/7bbf17d09d5f87b93022d340e39d53f386d5d485/pr-11777
  7. Create a PR, ensure that the CI is green. If it's not — update it so that
    the tests and any other checks pass. This is it!
    Now relax and wait for the maintainers to process your pull request
    when they have some cycles to do reviews. Don't worry — they'll tell you if
    any improvements are necessary when the time comes!

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.13 Trigger automatic backporting to the 3.13 release branch by Patchback robot backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client`s proxy auth not work in specially condition

3 participants