Summary Files Commits Branches @commit @diff @stats
path: root / badwolf.c
diff options
context:
space:
mode:
1 files changed, 23 insertions, 1 deletions
-rw-r--r--badwolf.c24
diff --git a/badwolf.c b/badwolf.c
index a0a7d09..8578404 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -440,7 +440,11 @@ WebViewCb_load_failed_with_tls_errors(WebKitWebView *web_view,
gchar *error_details = detail_tls_certificate_flags(errors);
gint dialog_response;
+#ifndef USE_LIBSOUP2
GUri *failing_uri = g_uri_parse(failing_text, G_URI_FLAGS_NONE, NULL);
+#else
+ SoupURI *failing_uri = soup_uri_new(failing_text);
+#endif
GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(browser->window->main_window),
GTK_DIALOG_MODAL & GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -461,12 +465,30 @@ WebViewCb_load_failed_with_tls_errors(WebKitWebView *web_view,
if(dialog_response == 1)
{
+#ifndef USE_LIBSOUP2
webkit_web_context_allow_tls_certificate_for_host(
webkit_web_view_get_context(browser->webView), certificate, g_uri_get_host(failing_uri));
+#else
+ webkit_web_context_allow_tls_certificate_for_host(
+ webkit_web_view_get_context(browser->webView), certificate, failing_uri->host);
+#endif
webkit_web_view_reload(browser->webView);
}
- g_free(failing_uri);
+#ifndef USE_LIBSOUP2
+ /* Calling g_free(failing_uri) ought to be the correct way but this causes a segfault.
+ *
+ * - documentation describes it as something which should be free
+ * - implementation seems to make it a pointer that should be freed
+ * - epiphany doesn't seems to free/unref it but gnome code seems to frequently have memleaks
+ *
+ * Decided to at least continue to try with using g_uri_unref(failing_uri) instead.
+ * Related fediverse post: <https://queer.hacktivis.me/objects/cec7c4e8-6a58-4358-85bf-b66f9bb21a98>
+ */
+ g_uri_unref(failing_uri);
+#else
+ soup_uri_free(failing_uri);
+#endif
g_free(error_details);
gtk_widget_destroy(dialog);