Quantcast
Channel: Active questions tagged https - Stack Overflow
Viewing all articles
Browse latest Browse all 1486

How to accept all certificates (even invalid) using HTTPS in libsoup?

$
0
0

I am using libsoup in my Vala application to download images. But my program always crashes with SSL_FAILED code (it's not in the program, it's me trowing an error) and no image is downloaded. I switched ssl_strict to false in my application, but it doesn't work the way I want it to.

Here is my function which downloads images:

var session = new Soup.Session ();session.ssl_strict = false;var message = new Soup.Message ("GET", url);message.tls_errors = GLib.TlsCertificateFlags.VALIDATE_ALL;session.send_message (message);if (message.status_code != Soup.Status.OK)    error("Something wrong with downloading."); // here it crashes

I checked documentation, and it says: "If you set “ssl-strict” to FALSE, then all certificates will be accepted, and you will need to call soup_message_get_https_status() to distinguish valid from invalid certificates. (This can be used, eg, if you want to accept invalid certificates after giving some sort of warning.)".

I don't know if the received certificate is invalid, but apparently yes. And the documentation doesn't say a word how to use it to accept invalid certificated. So, the question: how to use this function to accept ALL (even invalid) certificates?


Viewing all articles
Browse latest Browse all 1486

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>