[grilo/wip/hadess/remove-soup-from-mock] net: Remove direct libsoup dep from mock backend




commit 11320120f42650fc0728577a1a8a4d33836fa468
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jul 4 11:20:33 2022 +0200

    net: Remove direct libsoup dep from mock backend
    
    The mock backend just manipulates URIs, so require a newer version of
    GLib and use GUri to parse those instead of SoupURI.

 libs/net/grl-net-mock.c | 18 ++++++++++++------
 meson.build             |  2 +-
 2 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/libs/net/grl-net-mock.c b/libs/net/grl-net-mock.c
index 0aebceb..52a5ca2 100644
--- a/libs/net/grl-net-mock.c
+++ b/libs/net/grl-net-mock.c
@@ -28,7 +28,6 @@
 #include <glib/gi18n-lib.h>
 #include <glib/gstdio.h>
 #include <gio/gio.h>
-#include <libsoup/soup.h>
 #include <string.h>
 
 #define _GRILO_H_INSIDE_
@@ -61,15 +60,22 @@ get_url_mocked (GrlNetWc *self,
   char *new_url;
 
   if (ignored_parameters) {
-    SoupURI *uri = soup_uri_new (url);
-    const char *query = soup_uri_get_query (uri);
+    g_autoptr(GUri) uri = g_uri_parse (url, G_URI_FLAGS_PARSE_RELAXED, NULL);
+    const char *query = g_uri_get_query (uri);
     if (query) {
+      g_autoptr(GUri) nuri = NULL;
       char *new_query = g_regex_replace (ignored_parameters,
                                          query, -1, 0,
                                          "", 0, NULL);
-      soup_uri_set_query (uri, *new_query ? new_query : NULL);
-      new_url = soup_uri_to_string (uri, FALSE);
-      soup_uri_free (uri);
+      nuri = g_uri_build (G_URI_FLAGS_NONE,
+                          g_uri_get_scheme (uri),
+                          NULL,
+                          g_uri_get_host (uri),
+                          g_uri_get_port (uri),
+                          g_uri_get_path (uri),
+                          *new_query ? new_query : NULL,
+                          g_uri_get_fragment (uri));
+      new_url = g_uri_to_string_partial (nuri, G_URI_FLAGS_NONE);
       g_free (new_query);
     } else {
       new_url = g_strdup (url);
diff --git a/meson.build b/meson.build
index 263ed81..0aabae7 100644
--- a/meson.build
+++ b/meson.build
@@ -37,7 +37,7 @@ grlpls_lt_version = '@0@.@1@.@2@'.format(soversion, current, grlpls_interface_ag
 grl_majorminor = '@0@.@1@'.format(version_array[0], version_array[1])
 grl_name = '@0@-@1@'.format(meson.project_name(), grl_majorminor)
 
-glib2_required = '2.58'
+glib2_required = '2.66'
 glib2_required_info = '>= @0@'.format(glib2_required)
 
 gio_dep = dependency('gio-2.0', version: glib2_required_info, required: true)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]