2

So yes, the "TLS support is not available" error. This is to be found at this thread as well. However, the solution mentioned is to install glib-networking. I installed this via msys2. While this does work when working in msys2, it does not work when you're just working in Windows 10.

What I mean by this is if I just double-click the program, it will give off this error. When I run it via msys2, it works. When I run it on Ubuntu it also works. The fault lies with Windows and I would suspect having to either add some DLLs or installing glib-networking in some other way.

Anyway, here is the code where the error occurred (I set C# highlighting b/c it's pretty much the same and Vala highlighting doesn't exist on here):

private static void HTTPSReq(string host, string href, string vars) {
    const uint16 PORT = 443;
        
    try {
        Resolver resolver = Resolver.get_default();
        List<InetAddress> addresses = resolver.lookup_by_name(host, null);
        InetAddress address = addresses.nth_data(0);

        SocketClient client = new SocketClient();
        client.tls = true;
        client.set_tls_validation_flags(TlsCertificateFlags.EXPIRED);
        SocketConnection conn = client.connect(new InetSocketAddress(address, PORT));

        int vars_length = vars.length;

        string message = @"POST $href HTTP/1.1\r\nHost: $host\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: $vars_length\r\n\r\n$vars";
        conn.output_stream.write(message.data);

        DataInputStream response = new DataInputStream(conn.input_stream);
        string line, lastLine = "";

        while ((line = response.read_line().strip()) != null) {
            lastLine = line;
        }

        label.set_text(lastLine);
    } catch (Error e) {
        label.set_text(e.message);
    }
}

e.message is the variable which contains "TLS support is not available"

So how do I make this work?

Community
  • 1
  • 1
Kelvin Bouma
  • 179
  • 1
  • 2
  • 12

0 Answers0