-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-99813: Start using SSL_sendfile
when available
#99907
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
Open
illia-v
wants to merge
46
commits into
python:main
Choose a base branch
from
illia-v:SSL_sendfile
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+438
−82
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
a018beb
Add methods for checking whether kTLS is used
illia-v 72e7f5e
Start using `SSL_sendfile` when available
illia-v cf24d78
Try fixing warnings
illia-v e9ef747
Use unsigned `size_t` instead of `Py_ssize_t`
illia-v 646d328
Merge branch 'main' into SSL_sendfile
illia-v 76353c7
Merge branch 'main'
illia-v 14832de
Make `sendfile_impl` more similar to `write_impl`
illia-v 6b41d31
Modify `test_ssl` to test `SSL_sendfile` calls
illia-v 8ac6ff9
Modify documentation and add a news entry
illia-v 5cf9483
Fix a test
illia-v fc8e82f
Rename `uses_ktls_for_write` to `uses_ktls_for_send`
illia-v 7fc9b50
Merge branch 'main' into SSL_sendfile
illia-v 1ba04ae
Update `versionchanged`
illia-v 365e0c0
Update a test to get successful HTTP responses
illia-v 8fbc955
Add setting errors
illia-v 21ea0ca
Fix conditions
illia-v 17d9685
Add handling of `SSL_R_UNINITIALIZED`
illia-v a92ae7e
Merge branch 'main' into SSL_sendfile
illia-v 4e8b6d8
Modify `test_sendfile` to avoid the internet
illia-v 379d242
Refactor `test_sendfile` a bit
illia-v 7de3dcb
Merge branch 'main' into SSL_sendfile
illia-v bbe21c0
Merge branch 'main' into SSL_sendfile
illia-v 7323ec0
Try to fix new warnings
illia-v 2dc6947
Merge branch 'main' into SSL_sendfile
illia-v 6e902ad
Merge branch 'main' into SSL_sendfile
illia-v e435b9a
Apply a change from ea9a296fce2f786b4cf43c7924e5de01061f27ca
illia-v ac1b2b2
Merge branch 'main' into SSL_sendfile
illia-v 7d11a59
Merge branch 'main' into SSL_sendfile
illia-v 99e89d3
Merge branch 'main' into SSL_sendfile
illia-v dc626c8
Merge branch 'main' into SSL_sendfile
illia-v 291a5b7
Set `versionchanged` to next in docs
illia-v 3193ba4
Merge branch 'main' into SSL_sendfile
illia-v d870f92
Merge branch 'main' into SSL_sendfile
illia-v 94e522e
Apply some suggestions from code review
illia-v 25bde6f
Apply suggestions to Python code
illia-v 9a6a120
Improve style of `_ssl__SSLSocket_sendfile_impl`
illia-v eaa0b2c
Merge branch 'main' into SSL_sendfile
illia-v 05a0c6c
Drop `_sendfile_use_ssl_sendfile`
illia-v 6b4eed6
Merge remote-tracking branch 'python/main' into SSL_sendfile
illia-v 31ed52d
Apply suggestions from code review
illia-v 5a22e6b
Merge branch 'main' into SSL_sendfile
illia-v ada3f30
Improve kTLS checks for older OpenSSL
illia-v 3350854
Merge branch 'main' into SSL_sendfile
illia-v 3339673
Rename `uses_ktls_for_read` to `uses_ktls_for_recv`
illia-v ee573ad
Apply PEP 7
illia-v 6795f62
Use an alternative method of returning booleans
illia-v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
Misc/NEWS.d/next/Library/2023-03-13-22-51-40.gh-issue-99813.40TV02.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Python now uses ``SSL_sendfile`` internally when it is possible (see | ||
:data:`~ssl.OP_ENABLE_KTLS`). The function sends a file more efficiently | ||
because it performs TLS encryption in the kernel to avoid additional context | ||
switches. Patch by Illia Volochii. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check whether it "seems" to work or not? (for a personal project I would accept this but I'm interested in knowing whether this is an issue with Python SSL or OpenSSL)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll post more details about this soon
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can reproduce the same issue with C code using OpenSSL (without Python). Please check my findings here. I mentioned a possible patch, let me know if we can apply it or there can be undesirable consequences.
FYI,
ssl.OP_ENABLE_KTLS
to enable kTLS has been available since Python 3.12 (and it could be added to options as a simple integer even before). And the issue is not specific toSSL_sendfile
, it affects kTLS availability for simple reads and writes.I added my reproducer to an existing OpenSSL issue openssl/openssl#19676 (comment).