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

When to call SSL_shutdown() ? #26242

Closed
rakeshcpp opened this issue Dec 22, 2024 Discussed in #26205 · 3 comments
Closed

When to call SSL_shutdown() ? #26242

rakeshcpp opened this issue Dec 22, 2024 Discussed in #26205 · 3 comments

Comments

@rakeshcpp
Copy link

Discussed in #26205

Originally posted by rakeshcpp December 18, 2024
Suppose while receiving response(ssl_read()), I found, in very first chunk(with non-blocking IO) that this is not what I am expecting(some header invalid etc.) then should I immediately close the connection using SSL_shutdown() call, or should I complete reading response first then call SSL_shutdown()?

If I close connection I got this error from ssl just for reference otherwise the above question itself is enough:
80D0743D4F7D0000:error:0A000123:SSL routines:ssl3_read_bytes:application data after close notify:../ssl/record/rec_layer_s3.c:1660:

@mattcaswell
Copy link
Member

You may call SSL_shutdown() immediately. If you do so, you should either then close the socket immediately (ignoring any remaining data - thus resetting the connection, and without calling SSL_shutdown() a second time). Alternatively you can choose to continue to read the remaining data via SSL_read.

@t8m t8m closed this as completed Dec 30, 2024
@t8m
Copy link
Member

t8m commented Dec 30, 2024

Please do not open duplicate issues!

@rakeshcpp
Copy link
Author

@t8m Thanks for kind help. I got it, but I have to check If I get those errors or not. I will check and ask if I need further help. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants