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

Add ClientResponse.certificate and populate it, if appropriate #7181

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

auxsvr
Copy link

@auxsvr auxsvr commented Jan 23, 2023

Fixes #2816.

What do these changes do?

Add ClientResponse.certificate and populate it, if appropriate.

Are there changes in behavior for the user?

Yes, the ClientResponse.certificate property contains the server certificate, if available.

Related issue number

#2816

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
    • 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."

@codecov
Copy link

codecov bot commented Jan 27, 2023

Codecov Report

Merging #7181 (d9172ae) into master (3a8e65f) will decrease coverage by 0.01%.
The diff coverage is 94.73%.

❗ Current head d9172ae differs from pull request most recent head 62435c0. Consider uploading reports for the commit 62435c0 to get more accurate results

@@            Coverage Diff             @@
##           master    #7181      +/-   ##
==========================================
- Coverage   97.31%   97.31%   -0.01%     
==========================================
  Files         106      106              
  Lines       31260    31278      +18     
  Branches     3891     3893       +2     
==========================================
+ Hits        30420    30437      +17     
  Misses        637      637              
- Partials      203      204       +1     
Flag Coverage Δ
CI-GHA 97.21% <94.73%> (-0.01%) ⬇️
OS-Linux 96.87% <94.73%> (-0.01%) ⬇️
OS-Windows 95.27% <94.73%> (-0.01%) ⬇️
OS-macOS 96.44% <94.73%> (-0.01%) ⬇️
Py-3.10.10 ?
Py-3.10.9 96.96% <94.73%> (-0.01%) ⬇️
Py-3.11.0 95.49% <26.31%> (-0.05%) ⬇️
Py-3.7.15 96.69% <94.73%> (-0.01%) ⬇️
Py-3.7.9 95.16% <94.73%> (-0.01%) ⬇️
Py-3.8.10 95.06% <94.73%> (-0.01%) ⬇️
Py-3.8.16 96.58% <94.73%> (-0.01%) ⬇️
Py-3.9.13 95.06% <94.73%> (-0.01%) ⬇️
Py-3.9.16 96.60% <94.73%> (-0.01%) ⬇️
Py-pypy7.3.11 94.11% <94.73%> (-0.02%) ⬇️
VM-macos 96.44% <94.73%> (-0.01%) ⬇️
VM-ubuntu 96.87% <94.73%> (-0.01%) ⬇️
VM-windows 95.27% <94.73%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
aiohttp/client_reqrep.py 97.58% <75.00%> (-0.15%) ⬇️
tests/test_client_request.py 99.58% <100.00%> (+<0.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@auxsvr auxsvr force-pushed the master branch 2 times, most recently from 85a6d61 to f2ef428 Compare January 28, 2023 16:39
CHANGES/2816.feature Outdated Show resolved Hide resolved
aiohttp/client_reqrep.py Outdated Show resolved Hide resolved
aiohttp/client_reqrep.py Outdated Show resolved Hide resolved
docs/client_reference.rst Outdated Show resolved Hide resolved
tests/test_client_request.py Outdated Show resolved Hide resolved
tests/test_client_request.py Outdated Show resolved Hide resolved
tests/test_client_request.py Outdated Show resolved Hide resolved
tests/test_client_request.py Outdated Show resolved Hide resolved
auxsvr and others added 3 commits February 13, 2023 10:22
The certificate must be populated before the EOF handler is assigned to avoid
a race condition if the connection is closed quickly.
@auxsvr
Copy link
Author

auxsvr commented Feb 28, 2023

The linter failure in mypy is spurious. Should I silence this instance or is there a better way?

@Dreamsorcerer
Copy link
Member

The linter failure in mypy is spurious. Should I silence this instance or is there a better way?

mypy is pretty much deterministic, the failure will appear every time.
In this case, the variable is defined as None in the class definition:
https://github.com/aio-libs/aiohttp/pull/7181/files#diff-720910fd022b9ba8b7ddf0cb446ce5e1afe443f4287ad26a1eb4dc4b5b5f4508R677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Feature request: add functionality to retrieve the the server certificate in a client request
3 participants