-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Using SocketsHttpHandler and NSUrlSessionHandler in the same net8.0-ios project causes incorrect 401 runtime errors for NTLM authorized HTTP requests #99892
Comments
From @rolfbjarne on Mon, 18 Mar 2024 10:07:54 GMT I can reproduce. This seems to be an issue in |
I'm wondering if this is related to #97966. Maybe not crashing (without GC.Collect) but the macOS GASSI mangles memory. Adding @filipnavara for more thoughts. |
We can test what happens with the Managed NTLM switch (or run on .NET 9 preview) to avoid the GSSAPI code paths that corrupt memory. Otherwise I don't have many ideas, |
is that something you can try @rolfbjarne since you already have repro? |
Just to save some time. It means adding this to the .csproj file: <ItemGroup>
<RuntimeHostConfigurationOption Include="System.Net.Security.UseManagedNtlm" Value="true" />
</ItemGroup> |
Yes, that seems to work. |
@rolfbjarne can we close this as duplicate of #97966, or is there something else we could do? |
CC @JeroenBer (the original reporter) |
This issue has been marked |
This issue has been automatically marked |
This issue will now be closed since it had been marked |
From @JeroenBer on Fri, 15 Mar 2024 15:17:31 GMT
We ported our Xamarin iOS application to .NET 8 (net8.0-ios). We use SocketsHttpHandler and NSUrlSessionHandler in the same project. We use SocketsHttpHandler for NTLM requests and NSUrlSessionHandler for other requests.
Ntlm SocketsHttpHandler can do HTTP requests with NTLM authorization. But if you also use NSUrlSessionHandler and once you hit a 401 in NSUrlSessionHandler it seems this has the nasty side effect that NTLM authorization in SocketsHttpHandler is broken.
Steps to Reproduce
Expected Behavior
SocketHttpHandler requests should not be influenced by NSUrlSessionHandler requests
Actual Behavior
401 on NSUrlSessionHandler causes NTLM to fail on SocketHttpHandler
Environment
Environment is Microsoft.iOS.Sdk/17.2.8022
Example Project (If Possible)
You can see this code unexpectedly fails now:
Copied from original issue xamarin/xamarin-macios#20311
The text was updated successfully, but these errors were encountered: