schannel, ignore error on recv beyond close notify#15381
Closed
icing wants to merge 2 commits into
Closed
Conversation
When receiving data, schannel does a recv from the lower filters, e.g. the socket, *before* it decrypts and analyses the buffered data it already has. When that buffer contains a close-notify, e.g. the end of the TLS stream, any error on the previous receive from the socket are not applicable to its return codes. Example from #153345: a server sends a close notify and closes its connection. The encrypted data, including the close notify is received. Another receive on the sockets gets a CONNABORTED which curl reports as CURLE_RECV_ERROR. Schannel analyses its bufferi, sees the close notify and early returns to the caller. On this return, the error on the attempted receive does not apply.
bagder
approved these changes
Oct 24, 2024
jay
approved these changes
Oct 24, 2024
Member
|
It occurs to me though this works for shutdown it could potentially cause a problem during a transfer because the recv error state recv_unrecoverable_err is not returned for future calls, so it may be safer to handle this directly in shutdown if possible. In other words, we would want future recv calls to error. Let me know if you think #15391 would work |
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
When receiving data, schannel does a recv from the lower filters, e.g. the socket, *before* it decrypts and analyses the buffered data it already has. When that buffer contains a close-notify, e.g. the end of the TLS stream, any error on the previous receive from the socket are not applicable to its return codes. Example from #153345: a server sends a close notify and closes its connection. The encrypted data, including the close notify is received. Another receive on the sockets gets a CONNABORTED which curl reports as CURLE_RECV_ERROR. Schannel analyses its bufferi, sees the close notify and early returns to the caller. On this return, the error on the attempted receive does not apply. Closes curl#15381
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When receiving data, schannel does a recv from the lower filters, e.g. the socket, before it decrypts and analyses the buffered data it already has. When that buffer contains a close-notify, e.g. the end of the TLS stream, any error on the previous receive from the socket are not applicable to its return codes.
Example from #15345: a server sends a close notify and closes its connection. The encrypted data, including the close notify is received. Another receive on the sockets gets a CONNABORTED which curl reports as CURLE_RECV_ERROR. Schannel analyses its bufferi, sees the close notify and early returns to the caller. On this return, the error on the attempted receive does not apply.