2dust / clashN

A clash client for Windows, support Mihomo
https://1.2345345.xyz
GNU General Public License v3.0
4.66k stars 587 forks source link

[8.0.100-preview.5.23276.4] After setting SocketsHttpHandler.AllowAutoRedirect property as false, the HttpResponseMessage.StatusCode changed from "Redirect" to "Found" #284

Closed Junjun-zhao closed 6 months ago

Junjun-zhao commented 1 year ago

Application Name: clashN OS: Windows10 21h2 CPU: x64 Dotnet build: dotnet-sdk-8.0.100-preview.5.23276.4

Test Steps: 1.Launch application clashN.exe. 2.Click “帮助和更新”. 3.Click “打开”. 4.Verify: Edge open successfully. 5.Close edge. 6.Click “检查更新”. 7.Click “Yes”.

Expected Result: The windows pop us successfully. Actual Result: No window shows.

This issue is related to response.StatusCode.ToString(). In this case HttpStatusCode.Found and HttpStatusCode.Redirect both share the value 302. Which one ToString() will return is not guaranteed to be stable.See "Notes to callers" section of Enum.ToString()) docs:

If multiple enumeration members have the same underlying value and you attempt to retrieve the string representation of an enumeration member's name based on its underlying value, your code should not make any assumptions about which name the method will return.

Please refer to more details from https://github.com/dotnet/runtime/issues/86857 .