Support passing a custom server name parameter on HTTPS connection#7541
Support passing a custom server name parameter on HTTPS connection#7541Dreamsorcerer merged 4 commits intoaio-libs:masterfrom multani:override-server_hostname
Conversation
|
Also, if the tests still don't work after those updates on 3.8 due to missing AsyncMock, feel free to add a |
|
@Dreamsorcerer thanks for all the good comments! 🙇 I made all the changes requested, it's better now! 👍 I'll keep an eye on the CI. |
|
Oh, I just realised you're pointing to the wrong branch. You need to target a PR to master. |
This add the missing support to set the `server_hostname` setting when creating TCP connection, when the underlying connection is authenticated using TLS. See the documentation for the 2 stdlib functions: * https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_connection * https://docs.python.org/3/library/asyncio-eventloop.html#opening-network-connections The implemention is similar to what was done in urllib3 in urllib3/urllib3#1397 This would be needed to support features in clients using aiohttp, such as tomplus/kubernetes_asyncio#267 Closes: #7114
Arghhh, sorry about that, I did my tests through another library that was using 3.8 and I used that branch for my personal PR before publishing it here 🤦 Sorry about the inconvenience, I just rebased/squashed all my changes on top of the master branch and changed the PR to point on that branch instead 🙇 |
Codecov Report
@@ Coverage Diff @@
## master #7541 +/- ##
=======================================
Coverage 97.34% 97.35%
=======================================
Files 106 106
Lines 31433 31490 +57
Branches 3571 3577 +6
=======================================
+ Hits 30600 30657 +57
Misses 630 630
Partials 203 203
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Backport to 3.9: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply ac29dea on top of patchback/backports/3.9/ac29dea2c6a01d718677bd26fcd09e847785d89f/pr-7541 Backporting merged PR #7541 into master
🤖 @patchback |
|
@Dreamsorcerer thanks a lot for the merge! 🎉 I can take care of the failing backport and create the related pull request if you want 👍 |
|
Thanks, that would be great. Just follow the instructions and create a PR to 3.9 branch. |
|
The backport is in #7543! |
…7543) This adds the missing support to set the `server_hostname` setting when creating TCP connection, when the underlying connection is authenticated using TLS. See the documentation for the 2 stdlib functions: * https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_connection * https://docs.python.org/3/library/asyncio-eventloop.html#opening-network-connections This would be needed to support features in clients using aiohttp, such as tomplus/kubernetes_asyncio#267 The default behavior should not change, but this would allow on a per-connection basis to specify a custom server name to check the certificate name against. Closes: #7114 Backport of #7541 to 3.9 - [x] I think the code is well written - [x] Unit tests for the changes exist - [x] Documentation reflects the changes - [x] 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. - [x] Add a new news fragment into the `CHANGES` folder * name it `<issue_id>.<type>` for example (588.bugfix) * if you don't have an `issue_id` change it to the pr id after creating the pr * ensure type is one of the following: * `.feature`: Signifying a new feature. * `.bugfix`: Signifying a bug fix. * `.doc`: Signifying a documentation improvement. * `.removal`: Signifying a deprecation or removal of public API. * `.misc`: A ticket has been closed, but it is not of interest to users. * Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files." --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sam Bull <[email protected]> (cherry picked from commit ac29dea)
What do these changes do?
This adds the missing support to set the
server_hostnamesetting when creating TCP connection, when the underlying connection is authenticated using TLS.See the documentation for the 2 stdlib functions:
This would be needed to support features in clients using aiohttp, such as tomplus/kubernetes_asyncio#267
Are there changes in behavior for the user?
The default behavior should not change, but this would allow on a per-connection basis to specify a custom server name to check the certificate name against.
Related issue number
Closes: #7114
(for reference, similar implementation in urllib3: urllib3/urllib3#1397)
Checklist
CONTRIBUTORS.txtCHANGESfolder<issue_id>.<type>for example (588.bugfix)issue_idchange it to the pr id after creating the pr.feature: Signifying a new feature..bugfix: Signifying a bug fix..doc: Signifying a documentation improvement..removal: Signifying a deprecation or removal of public API..misc: A ticket has been closed, but it is not of interest to users.