Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix connecting to npipe://, tcp://, and unix:// urls #8632

Merged
merged 35 commits into from
Aug 7, 2024
Merged

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 7, 2024

What do these changes do?

Fixes a regression in 3.10.x connecting to npipe://, tcp://, and unix:// urls

A future PR should remove allowed_protocol_schema_set in BaseConnector as its only there for backwards compat

Are there changes in behavior for the user?

no

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

no

Related issue number

fixes #8600

@bdraco bdraco added this to the 3.10.2 milestone Aug 7, 2024
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Aug 7, 2024
@bdraco bdraco added backport-3.10 Trigger automatic backporting to the 3.10 release branch by Patchback robot backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot labels Aug 7, 2024
aiohttp/client.py Outdated Show resolved Hide resolved
@bdraco bdraco changed the title Fix connecting to unix:// urls Fix connecting to npipe:// and unix:// urls Aug 7, 2024
@bdraco
Copy link
Member Author

bdraco commented Aug 7, 2024

CHANGES/8632.bugfix.rst Outdated Show resolved Hide resolved
aiohttp/connector.py Outdated Show resolved Hide resolved
aiohttp/connector.py Outdated Show resolved Hide resolved
aiohttp/connector.py Outdated Show resolved Hide resolved
@bdraco bdraco changed the title Fix connecting to npipe:// and unix:// urls Fix connecting to npipe://, tcp://, and unix:// urls Aug 7, 2024
CHANGES/8632.bugfix.rst Outdated Show resolved Hide resolved
aiohttp/connector.py Outdated Show resolved Hide resolved
aiohttp/connector.py Outdated Show resolved Hide resolved
tests/test_client_session.py Outdated Show resolved Hide resolved
tests/test_client_session.py Outdated Show resolved Hide resolved
tests/test_client_session.py Dismissed Show dismissed Hide dismissed
@Dreamsorcerer
Copy link
Member

I think this is good.

I'd note that a frozenset() isn't actually needed as the second operator to result in a frozenset. The .union("tcp") syntax also allows to skip creating an extra set entirely. I don't really mind though, just thought I'd point it out.

@bdraco
Copy link
Member Author

bdraco commented Aug 7, 2024

I think this is good.

I'd note that a frozenset() isn't actually needed as the second operator to result in a frozenset. The .union("tcp") syntax also allows to skip creating an extra set entirely. I don't really mind though, just thought I'd point it out.

I tried that first but it iterated each character in the string

@bdraco
Copy link
Member Author

bdraco commented Aug 7, 2024

Will fix the type when I get the next site. Have to drive now.

@bdraco bdraco merged commit b2691f2 into master Aug 7, 2024
37 of 38 checks passed
@bdraco bdraco deleted the fix_unix_tcp branch August 7, 2024 20:38
Copy link
Contributor

patchback bot commented Aug 7, 2024

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

❌ Failed to cleanly apply b2691f2 on top of patchback/backports/3.10/b2691f211511dc476ce4fb77f2293e4082a8a357/pr-8632

Backporting merged PR #8632 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.10/b2691f211511dc476ce4fb77f2293e4082a8a357/pr-8632 upstream/3.10
  4. Now, cherry-pick PR Fix connecting to npipe://, tcp://, and unix:// urls #8632 contents into that branch:
    $ git cherry-pick -x b2691f211511dc476ce4fb77f2293e4082a8a357
    If it'll yell at you with something like fatal: Commit b2691f211511dc476ce4fb77f2293e4082a8a357 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x b2691f211511dc476ce4fb77f2293e4082a8a357
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix connecting to npipe://, tcp://, and unix:// urls #8632 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.10/b2691f211511dc476ce4fb77f2293e4082a8a357/pr-8632
  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.

Copy link
Contributor

patchback bot commented Aug 7, 2024

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

❌ Failed to cleanly apply b2691f2 on top of patchback/backports/3.11/b2691f211511dc476ce4fb77f2293e4082a8a357/pr-8632

Backporting merged PR #8632 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.11/b2691f211511dc476ce4fb77f2293e4082a8a357/pr-8632 upstream/3.11
  4. Now, cherry-pick PR Fix connecting to npipe://, tcp://, and unix:// urls #8632 contents into that branch:
    $ git cherry-pick -x b2691f211511dc476ce4fb77f2293e4082a8a357
    If it'll yell at you with something like fatal: Commit b2691f211511dc476ce4fb77f2293e4082a8a357 is a merge but no -m option was given., add -m 1 as follows instead:
    $ git cherry-pick -m1 -x b2691f211511dc476ce4fb77f2293e4082a8a357
  5. At this point, you'll probably encounter some merge conflicts. You must
    resolve them in to preserve the patch from PR Fix connecting to npipe://, tcp://, and unix:// urls #8632 as close to the
    original as possible.
  6. Push this branch to your fork on GitHub:
    $ git push origin patchback/backports/3.11/b2691f211511dc476ce4fb77f2293e4082a8a357/pr-8632
  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.

bdraco added a commit that referenced this pull request Aug 7, 2024
Co-authored-by: Sam Bull <git@sambull.org>
(cherry picked from commit b2691f2)
bdraco added a commit that referenced this pull request Aug 7, 2024
Co-authored-by: Sam Bull <git@sambull.org>
(cherry picked from commit b2691f2)
bdraco added a commit that referenced this pull request Aug 7, 2024
… and unix:// urls (#8638)

Co-authored-by: Sam Bull <git@sambull.org>
bdraco added a commit that referenced this pull request Aug 7, 2024
… and unix:// urls (#8637)

Co-authored-by: Sam Bull <git@sambull.org>
@webknjaz
Copy link
Member

webknjaz commented Aug 7, 2024

@bdraco @Dreamsorcerer it would be worth also checking if connecting to abstract UNIX sockets works (it's a Linux-only feature).

@bdraco
Copy link
Member Author

bdraco commented Aug 7, 2024

The original PR that causes the regression only added validation for the schema part of the URL so I think we should be ok with the abstract Unix sockets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.10 Trigger automatic backporting to the 3.10 release branch by Patchback robot backport-3.11 Trigger automatic backporting to the 3.11 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.

Error while trying to use unix socket, when aiohttp>=3.10
3 participants