-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Check for the specific in-use version of OpenSSL when working with libcurl #32483
Conversation
…bcurl Rather than check a generic 1.0/1.1, test for the specific library version that the crypto shim has loaded. This makes things work when both libcurl and the crypto shim are using OpenSSL 1.1 and also prevents a state where two different copies of the library (at different patch versions) are utilized.
@dotnet-bot Test Outerloop Linux x64 Debug Build please |
internal const string SecureTransportDescription = "SecureTransport"; | ||
internal const string LibreSslDescription = "LibreSSL"; | ||
|
||
#if !SYSNETHTTP_NO_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.
It looks like this is defined in the tests project? The tests pull in this file? Ugh, but ok.
// Ask the product how it feels about this. | ||
Type interopHttp = typeof(HttpClient).Assembly.GetType("Interop+Http"); | ||
PropertyInfo hasMatchingOpenSslVersion = interopHttp.GetProperty("HasMatchingOpenSslVersion", BindingFlags.Static | BindingFlags.NonPublic); | ||
return (bool)hasMatchingOpenSslVersion.GetValue(null); |
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.
If the tests are pulling in the file anyway, do we need to exclude that code when built in the tests, or could we just use that rather than using reflection?
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.
The tests pull in that one file, but not the rest of the work for the HttpNative/CryptoNative initializer sequencing, and leaving it that way helps to avoid a Heisenbug where the tests end up doing the initialization on behalf of the product and the product eventually neglects to do so.
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.
LGTM. We will still prefer 1.1 for crypto & SskStream, right?
For 3.0, yep. This just makes it so that our "can we use OpenSSL via libcurl" matches what we picked, curl's bound library won't influence our loader preference. |
@wfurt and I talked about the tests that are failing, and it seems like we're in a better state with this checked in while the remaining OuterLoop failures get investigated, so merging it as-is (InnerLoop is fine) |
Rather than check a generic 1.0/1.1, test for the specific library version that
the crypto shim has loaded. This makes things work when both libcurl
and the crypto shim are using OpenSSL 1.1 and also prevents a state where two
different copies of the library (at different patch versions) are utilized.
Fixes #32343.
Related to #32006 / #9855.