pantry/projects/libsoup.org/test.c
Andrew ba54f0718a
libsoup.org (#4058)
* new file:   projects/gnome.org/libsoup/package.yml
	new file:   projects/gnome.org/libsoup/test.c

* maybe gcc

* test flags

* modified:   projects/gnome.org/libsoup/test.c

* let's print error msg

* openssl

* SOUP_SSL_STRICT

* .

* +curl.se/ca-certs

* deps

* .

* modified:   projects/gnome.org/libsoup/package.yml

* rename & test

---------

Co-authored-by: Jacob Heider <jacob@pkgx.dev>
2023-11-17 12:07:39 -05:00

26 lines
819 B
C

#include <libsoup/soup.h>
static gboolean
accept_certificate_callback(SoupMessage *msg, GTlsCertificate *certificate,
GTlsCertificateFlags tls_errors, gpointer user_data)
{
// Here you can inspect @certificate or compare it against a trusted one
// and you can see what is considered invalid by @tls_errors.
// Returning TRUE trusts it anyway.
return TRUE;
}
int main(int argc, char *argv[])
{
SoupMessage *msg = soup_message_new(SOUP_METHOD_GET, "https://tea.xyz/");
SoupSession *session = soup_session_new();
g_signal_connect(msg, "accept-certificate", G_CALLBACK(accept_certificate_callback), NULL);
GInputStream *in_stream = soup_session_send(session, msg, NULL, NULL);
if (in_stream)
{
g_object_unref(in_stream);
}
return 0;
}