[grilo-plugins/wip/hadess/soup3: 1/2] dleyna: Port to GUri and remove libsoup dependency
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/hadess/soup3: 1/2] dleyna: Port to GUri and remove libsoup dependency
- Date: Wed, 6 Jul 2022 08:31:41 +0000 (UTC)
commit dad75b143a0381231237df3181c70f132b9129e0
Author: Bastien Nocera <hadess hadess net>
Date: Wed Jul 6 10:29:51 2022 +0200
dleyna: Port to GUri and remove libsoup dependency
Remove libsoup dependency and bump glib dependency to 2.66 so we can use
GUri instead of SoupURI.
meson.build | 4 ++--
src/dleyna/grl-dleyna-utils.c | 21 ++++++++++-----------
src/dleyna/grl-dleyna-utils.h | 2 --
3 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/meson.build b/meson.build
index f539cd2f..5d20f1a0 100644
--- a/meson.build
+++ b/meson.build
@@ -26,7 +26,7 @@ libdir = get_option('libdir')
datadir = get_option('datadir')
pluginsdir =join_paths(libdir, 'grilo-@0@.@1@'.format(grl_major, grl_minor))
-glib2_required = '2.44'
+glib2_required = '2.66'
grilo_required = '0.3.8'
glib2_required_info = '>= @0@'.format(glib2_required)
grilo_required_info = '>= @0@'.format(grilo_required)
@@ -125,7 +125,7 @@ OPT_DEPS = 2
plugins = [ # NAME, REQ_DEPS, OPT_DEPS
['bookmarks', [gio_dep, libxml_dep, gom_dep], []],
['chromaprint', [gstreamer_dep], []],
- ['dleyna', [gio_dep, gio_unix_dep, libsoup24_dep], []],
+ ['dleyna', [gio_dep, gio_unix_dep], []],
['dmap', [libdmapsharing_dep, libxml_dep], []],
['filesystem', [grilo_pls_dep], []],
['flickr', [grilo_net_dep, libxml_dep, oauth_dep], [goa_dep]],
diff --git a/src/dleyna/grl-dleyna-utils.c b/src/dleyna/grl-dleyna-utils.c
index cbfbe213..ba5c0c88 100644
--- a/src/dleyna/grl-dleyna-utils.c
+++ b/src/dleyna/grl-dleyna-utils.c
@@ -27,7 +27,6 @@
#include <string.h>
#include <stdlib.h>
#include <gio/gio.h>
-#include <libsoup/soup.h>
#ifdef G_OS_UNIX
#include <sys/types.h>
@@ -337,15 +336,19 @@ grl_dleyna_util_uri_is_localhost (const gchar *uri,
char hostname_buffer[HOSTNAME_LENGTH+1];
const char *host;
GInetAddress *ip_address;
- SoupURI *s_uri;
+ g_autoptr(GUri) g_uri = NULL;
- s_uri = soup_uri_new (uri);
+ g_uri = g_uri_parse (uri,
+ G_URI_FLAGS_HAS_PASSWORD |
+ G_URI_FLAGS_ENCODED_PATH |
+ G_URI_FLAGS_ENCODED_QUERY |
+ G_URI_FLAGS_ENCODED_FRAGMENT |
+ G_URI_FLAGS_SCHEME_NORMALIZE, NULL);
- host = soup_uri_get_host (s_uri);
+ host = g_uri_get_host (g_uri);
if (host == NULL) {
*localhost = FALSE;
*localuser = FALSE;
- soup_uri_free (s_uri);
return;
}
@@ -358,18 +361,16 @@ grl_dleyna_util_uri_is_localhost (const gchar *uri,
if (addresses == NULL) {
*localhost = FALSE;
*localuser = FALSE;
- soup_uri_free (s_uri);
return;
}
*localhost = TRUE;
- sockaddr = G_SOCKET_ADDRESS (g_inet_socket_address_new (addresses->data, s_uri->port));
+ sockaddr = G_SOCKET_ADDRESS (g_inet_socket_address_new (addresses->data, g_uri_get_port (g_uri)));
*localuser = is_our_user (sockaddr);
g_object_unref (sockaddr);
g_list_free_full (addresses, g_object_unref);
- soup_uri_free (s_uri);
return;
}
@@ -377,7 +378,6 @@ grl_dleyna_util_uri_is_localhost (const gchar *uri,
if (ip_address == NULL) {
*localhost = FALSE;
*localuser = FALSE;
- soup_uri_free (s_uri);
return;
}
@@ -385,7 +385,7 @@ grl_dleyna_util_uri_is_localhost (const gchar *uri,
if (*localhost) {
GSocketAddress *sockaddr;
- sockaddr = G_SOCKET_ADDRESS (g_inet_socket_address_new (ip_address, s_uri->port));
+ sockaddr = G_SOCKET_ADDRESS (g_inet_socket_address_new (ip_address, g_uri_get_port (g_uri)));
*localuser = is_our_user (sockaddr);
g_object_unref (sockaddr);
@@ -394,7 +394,6 @@ grl_dleyna_util_uri_is_localhost (const gchar *uri,
}
g_object_unref (ip_address);
- soup_uri_free (s_uri);
}
#else
diff --git a/src/dleyna/grl-dleyna-utils.h b/src/dleyna/grl-dleyna-utils.h
index b342db8c..31cf35df 100644
--- a/src/dleyna/grl-dleyna-utils.h
+++ b/src/dleyna/grl-dleyna-utils.h
@@ -21,8 +21,6 @@
#ifndef _GRL_DLEYNA_UTILS_H_
#define _GRL_DLEYNA_UTILS_H_
-#include <libsoup/soup.h>
-
G_BEGIN_DECLS
void grl_dleyna_util_uri_is_localhost (const gchar *uri,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]