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

url: close TLS before removing conn from cache #3531

Closed
wants to merge 1 commit into from
Closed

url: close TLS before removing conn from cache #3531

wants to merge 1 commit into from

Conversation

chris-araman
Copy link
Contributor

Fixes: #3412 #3505

Ensures any TLS shutdown messages are sent before removing the association between the connection and the easy handle. Reverts @bagder's previous partial fix for #3412.

Note that conn_free also calls Curl_ssl_close on PRIMARYSOCKET and SECONDARYSOCKET, but that was the case before fb445a1.

@jay jay closed this in 927a5bd Feb 6, 2019
@chris-araman
Copy link
Contributor Author

Thanks!

@jay
Copy link
Member

jay commented Feb 6, 2019

Thanks. As you figured out Curl_ssl_close may write to the sockets and does in schannel and so expects at various points conn->data.

Note that conn_free also calls Curl_ssl_close on PRIMARYSOCKET and SECONDARYSOCKET

I'm interested in why that is, it seems more appropriate for disconnect. It's commented:

curl/lib/url.c

Lines 671 to 674 in 927a5bd

/* close the SSL stuff before we close any sockets since they will/may
write to the sockets */
Curl_ssl_close(conn, FIRSTSOCKET);
Curl_ssl_close(conn, SECONDARYSOCKET);

Currently though there is no guarantee of conn->data so if a shutdown needs to send or receive (like schannel) we run into the same problem if it's NULL. conn_free (as of your change) is no longer called in a way I can see that happening. Regardless I added a DEBUGASSERT(data) to the shutdown for schannel. I wonder what the downside would be to removing the ssl closes in conn_free, aren't they more correct just in the disconnect @bagder?

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Crash with WinSSL
2 participants