-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Unable to make HTTPS requests with C#'s built-in class (not HTTPRequest) (fixed in master
)
#36958
Comments
Did you tried to recreate the issue using gdscript, if using gdscript the problem may be with c# lib, not the engine itself! |
Sorry, this place is to report bug about Godot, not really about thirdparty libraries. Regarding your question about how you could use mozroot inside Godot, you should ask on the other community channels first. |
Well, the point is that making http requests as one normally would in C# doesn't seem to work with how Mono is implemented - whether this is in a 3rd party library or not |
Yes, this is not a bug in a thitdparty library, but Godot and how it uses mono. |
I mean, if OP does not use a Godot internal class (like HTTPRequest), how can this be a Godot issue ? We don't have the hand on the code made by the user. |
Fair point - i don't get it either. It seems to me that the issue is related to validating ssl/tls, specifically on Windows. I just tried the endpoint with a Godot HTTPRequest. This works, but our function (which we use cross platform in both mono and .NET) does not. Here's the request function
It works just fine in a standard dotnet application, but not from withing Godot. |
What happens if you run Godot with the environment variable |
Also, for clarification, on Windows this works on the Godot editor but not exported games? |
I tried putting
|
No, it fails both in the editor and when exported. |
Followup:
If the url is changed to I also tried using the RestSharp library to perform the requests - same story, works with http. |
Thanks for the example code. I'll be testing this later this week. |
Any news or workarounds for this so far? My best guess is, that it doesn't find the certificates. By the way, I tried all of these: |
@X52p You should be able to use Godot's HTTPRequest class from C#. It uses the Mozilla certificate bundle included in the Godot binary by default. |
I haver not been able to find a proper workaround, other than using a non-https endpoint - but i haven't tried it again since 3.2.2 came out. |
The problem is, that I'm using a library that is doing the requests. So I can't just replace the commands. |
Excactly |
Did anyone try to use a different build tool? (In Editor Settings -> Mono -> Builds and than something other than VS Build Tools) Is there any documentation on how to use them? Then I could set them up correctly and give it a try. (I'm new to using Mono and NuGet, sorry if this is a stupid question) |
I just compiled Godot 3.2 with Mono myself. Also doing this before building:
Were myCert.pem is the certificate of the server I'm trying to connect to. |
I think this issue is because of how the official Godot binaries are built. In Mono, there's an #if MONO_FEATURE_BTLS
[MethodImpl (MethodImplOptions.InternalCall)]
internal extern static bool IsBtlsSupported ();
#endif The above function points to a C function that returns true if |
Here's a build of Godot 3.4 beta 2 with the fixed Mono builds from godotengine/godot-mono-builds#47 https://downloads.tuxfamily.org/godotengine/testing/Godot_v3.4-beta2_mono_with-btls_win64.zip Could you confirm that it works as expected? |
|
Thanks, something seems to still be off. Continuing debugging in godotengine/godot-mono-builds#47. |
Note: Fixed in Godot 4 which uses .NET 6 (#64089 (comment)) |
master
)
This was closed again by mistake when updating a fork. But since this was fixed in 4.0, and no contributor is working on it for 3.x, I think we can leave it closed. |
Godot version: 3.2 stable
OS/device including version: Windows 10
Issue description:
We have a C# library, that includes a Log service, which we use in most our projects (of any kind). This service runs in a thread an POST's a bunch of strings to our server.
Implementing this Log service works just fine on my Linux machine, but when i deploy on a Windows machine (or my coworker runs it in the editor on his Windows machine), the web request fails with
Error: SecureChannelFailure (The authentication or decryption has failed.)
.Here's a full stack trace:
If i remove the s from the url, and stop our server from redirecting to https, it works, so this definitely has to do with tls.
I have tried overriding the ServerCertificateValidationCallback with
as per this stackoverflow post
I have also tried forcing tls 1.2:
According to monos documentation, you can import certificates with a tool called mozroots, but it does not seem to be bundled with Godot. Is there a way to use this tool from my code, so I don't have to manually run it for every pc i deploy to?
Steps to reproduce:
Make a https request from C#/mono on a Windows machine
Minimal reproduction project:
New C# project, that creates an HTTP request to a https-url, using either System.Net.WebRequest or System.Net.WebClient.
The text was updated successfully, but these errors were encountered: