mirror of
https://github.com/BepInEx/dotnet-runtime.git
synced 2026-11-27 13:19:31 -10:00
When a server offers multiple auth schemes, WinHttpHandler is supposed to select the more secure scheme regardless of the order of the authentication headers. So, despite a server offering Basic and Negotitate (in that order), Negotiate would be selected. When using default credentials, however, it was not calling WinHttpSetCredentials(null, null). This resulted in the first scheme offered by the server (Basic) to be attempted. But there were no credentials set and so a 401 resulted. Fix WinHttpHandler so that it will always call WinHttpSetCredentials even with default credentials. This ensures that the selected auth scheme (in this case Negotiate) is used correctly. Revised test configuration instructions. An IHttpModule is used for the test server endpoint to ensure that IIS will put 'Basic' first in the response headers. Commit migrated from https://github.com/dotnet/corefx/commit/9c6821d9d39ebe67b03f6e491489ffbb44844612