From 39525e8cdc33154724b6ef239d968d3f0138ffe3 Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Wed, 27 Dec 2023 14:21:43 +0100 Subject: [PATCH 01/12] port to libsoup3 Signed-off-by: Fabrice Fontaine --- .github/workflows/main.yml | 4 +-- configure.ac | 2 +- libgstd/gstd_http.c | 59 ++++++++++++++++++++------------------ meson.build | 2 +- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index df13a359..9488ff2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,7 +31,7 @@ jobs: sudo apt update sudo apt install automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev sudo apt install libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup2.4-dev + sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev - name: Generate run: ./autogen.sh - name: Configure @@ -70,7 +70,7 @@ jobs: sudo apt update sudo apt install automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev sudo apt install libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup2.4-dev + sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev sudo apt install ninja-build python3-wheel sudo pip3 install meson diff --git a/configure.ac b/configure.ac index 7152a175..b414ead1 100644 --- a/configure.ac +++ b/configure.ac @@ -85,7 +85,7 @@ PKG_CHECK_MODULES(GST, [ ]) ]) -PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.32]) +PKG_CHECK_MODULES(LIBSOUP, [libsoup-3.0 >= 2.99]) AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) diff --git a/libgstd/gstd_http.c b/libgstd/gstd_http.c index ef4a20f5..bbc5c9b2 100644 --- a/libgstd/gstd_http.c +++ b/libgstd/gstd_http.c @@ -39,7 +39,7 @@ GST_DEBUG_CATEGORY_STATIC (gstd_http_debug); typedef struct _GstdHttpRequest { SoupServer *server; - SoupMessage *msg; + SoupServerMessage *msg; GstdSession *session; const char *path; GHashTable *query; @@ -73,19 +73,18 @@ static GstdReturnCode gstd_http_stop (GstdIpc * base); static gboolean gstd_http_init_get_option_group (GstdIpc * base, GOptionGroup ** group); static SoupStatus get_status_code (GstdReturnCode ret); -static GstdReturnCode do_get (SoupServer * server, SoupMessage * msg, +static GstdReturnCode do_get (SoupServer * server, SoupServerMessage * msg, char **output, const char *path, GstdSession * session); -static GstdReturnCode do_post (SoupServer * server, SoupMessage * msg, +static GstdReturnCode do_post (SoupServer * server, SoupServerMessage * msg, char *name, char *description, char **output, const char *path, GstdSession * session); -static GstdReturnCode do_put (SoupServer * server, SoupMessage * msg, +static GstdReturnCode do_put (SoupServer * server, SoupServerMessage * msg, char *name, char **output, const char *path, GstdSession * session); -static GstdReturnCode do_delete (SoupServer * server, SoupMessage * msg, +static GstdReturnCode do_delete (SoupServer * server, SoupServerMessage * msg, char *name, char **output, const char *path, GstdSession * session); static void do_request (gpointer data_request, gpointer eval); -static void server_callback (SoupServer * server, SoupMessage * msg, - const char *path, GHashTable * query, SoupClientContext * context, - gpointer data); +static void server_callback (SoupServer * server, SoupServerMessage * msg, + const char *path, GHashTable * query, gpointer data); static void gstd_http_class_init (GstdHttpClass * klass) @@ -168,7 +167,7 @@ get_status_code (GstdReturnCode ret) } static GstdReturnCode -do_get (SoupServer * server, SoupMessage * msg, char **output, const char *path, +do_get (SoupServer * server, SoupServerMessage * msg, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -189,7 +188,7 @@ do_get (SoupServer * server, SoupMessage * msg, char **output, const char *path, } static GstdReturnCode -do_post (SoupServer * server, SoupMessage * msg, char *name, +do_post (SoupServer * server, SoupServerMessage * msg, char *name, char *description, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -224,7 +223,7 @@ do_post (SoupServer * server, SoupMessage * msg, char *name, } static GstdReturnCode -do_put (SoupServer * server, SoupMessage * msg, char *name, char **output, +do_put (SoupServer * server, SoupServerMessage * msg, char *name, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -254,7 +253,7 @@ do_put (SoupServer * server, SoupMessage * msg, char *name, char **output, } static GstdReturnCode -do_delete (SoupServer * server, SoupMessage * msg, char *name, +do_delete (SoupServer * server, SoupServerMessage * msg, char *name, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -294,11 +293,12 @@ do_request (gpointer data_request, gpointer eval) const gchar *description = NULL; SoupStatus status = SOUP_STATUS_OK; SoupServer *server = NULL; - SoupMessage *msg = NULL; + SoupServerMessage *msg = NULL; GstdSession *session = NULL; const char *path = NULL; GHashTable *query = NULL; GstdHttpRequest *data_request_local = NULL; + const char *method; g_return_if_fail (data_request); @@ -316,15 +316,16 @@ do_request (gpointer data_request, gpointer eval) description_pipe = g_hash_table_lookup (query, "description"); } - if (msg->method == SOUP_METHOD_GET) { + method = soup_server_message_get_method (msg); + if (method == SOUP_METHOD_GET) { ret = do_get (server, msg, &output, path, session); - } else if (msg->method == SOUP_METHOD_POST) { + } else if (method == SOUP_METHOD_POST) { ret = do_post (server, msg, name, description_pipe, &output, path, session); - } else if (msg->method == SOUP_METHOD_PUT) { + } else if (method == SOUP_METHOD_PUT) { ret = do_put (server, msg, name, &output, path, session); - } else if (msg->method == SOUP_METHOD_DELETE) { + } else if (method == SOUP_METHOD_DELETE) { ret = do_delete (server, msg, name, &output, path, session); - } else if (msg->method == SOUP_METHOD_OPTIONS) { + } else if (method == SOUP_METHOD_OPTIONS) { ret = GSTD_EOK; } @@ -336,15 +337,15 @@ do_request (gpointer data_request, gpointer eval) g_free (output); output = NULL; - soup_message_set_response (msg, "application/json", SOUP_MEMORY_COPY, + soup_server_message_set_response (msg, "application/json", SOUP_MEMORY_COPY, response, strlen (response)); g_free (response); response = NULL; status = get_status_code (ret); - soup_message_set_status (msg, status); + soup_server_message_set_status (msg, status, NULL); g_mutex_lock (data_request_local->mutex); - soup_server_unpause_message (server, msg); + soup_server_message_unpause (msg); g_mutex_unlock (data_request_local->mutex); if (query != NULL) { @@ -357,13 +358,14 @@ do_request (gpointer data_request, gpointer eval) } static void -server_callback (SoupServer * server, SoupMessage * msg, +server_callback (SoupServer * server, SoupServerMessage * msg, const char *path, GHashTable * query, - SoupClientContext * context, gpointer data) + gpointer data) { GstdSession *session = NULL; GstdHttp *self = NULL; GstdHttpRequest *data_request = NULL; + SoupMessageHeaders *response_headers = NULL; g_return_if_fail (server); g_return_if_fail (msg); @@ -385,14 +387,15 @@ server_callback (SoupServer * server, SoupMessage * msg, } data_request->mutex = &self->mutex; - soup_message_headers_append (msg->response_headers, + response_headers = soup_server_message_get_request_headers (msg); + soup_message_headers_append (response_headers, "Access-Control-Allow-Origin", "*"); - soup_message_headers_append (msg->response_headers, + soup_message_headers_append (response_headers, "Access-Control-Allow-Headers", "origin,range,content-type"); - soup_message_headers_append (msg->response_headers, + soup_message_headers_append (response_headers, "Access-Control-Allow-Methods", "PUT, GET, POST, DELETE"); g_mutex_lock (&self->mutex); - soup_server_pause_message (server, msg); + soup_server_message_pause (msg); g_mutex_unlock (&self->mutex); if (!g_thread_pool_push (self->pool, (gpointer) data_request, NULL)) { GST_ERROR_OBJECT (self->pool, "Thread pool push failed"); @@ -420,7 +423,7 @@ gstd_http_start (GstdIpc * base, GstdSession * session) gstd_http_stop (base); GST_DEBUG_OBJECT (self, "Initializing HTTP server"); - self->server = soup_server_new (SOUP_SERVER_SERVER_HEADER, "Gstd-1.0", NULL); + self->server = soup_server_new ("server-header", "Gstd-1.0", NULL); if (!self->server) { goto noconnection; } diff --git a/meson.build b/meson.build index 7d7eacd9..2d41645c 100644 --- a/meson.build +++ b/meson.build @@ -27,7 +27,7 @@ json_glib_dep = dependency('json-glib-1.0', version : '>=0.16.2') libd_dep = dependency('libdaemon', version : '>=0.14') jansson_dep = dependency('jansson', version : '>=2.7') thread_dep = dependency('threads') -libsoup_dep = dependency('libsoup-2.4', version : '>=2.4') +libsoup_dep = dependency('libsoup-3.0', version : '>=2.99') libedit_dep = dependency('libedit', version : '>=3.0') gst_check_required = get_option('enable-tests').enabled() From 568921e2a51bd60a95c40b63add0a7aac93c6672 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Mon, 11 Aug 2025 17:27:56 -0600 Subject: [PATCH 02/12] Add support for libsoup2.4 and libsoup3 --- configure.ac | 23 ++++++++++++++++- libgstd/gstd_http.c | 62 ++++++++++++++++++++++++++++++++++----------- meson.build | 56 +++++++++++++++++++++------------------- 3 files changed, 99 insertions(+), 42 deletions(-) diff --git a/configure.ac b/configure.ac index b414ead1..d6583ca6 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,10 @@ AC_INIT([gstd],[0.15.2]) dnl required version of gstreamer and gst-plugins-base GST_REQUIRED=1.0.0 +dnl required version of libsoup +LIBSOUP3_REQUIRED=3.0 +LIBSOUP2_REQUIRED=2.4 + dnl required version of gio GIO_REQUIRED=2.44.1 @@ -85,7 +89,24 @@ PKG_CHECK_MODULES(GST, [ ]) ]) -PKG_CHECK_MODULES(LIBSOUP, [libsoup-3.0 >= 2.99]) +PKG_CHECK_MODULES([LIBSOUP], [libsoup-3.0 >= 3.0], [ + AC_DEFINE([HAVE_LIBSOUP3], [1], [Define if libsoup3 exists.]) +], [ + PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= 2.4], [ + AC_DEFINE([HAVE_LIBSOUP2], [1], [Define if libsoup2 exists.]) + ], [ + AC_MSG_ERROR([ + Can't find the following LIBSOUP development packages: + + libsoup-3.0 >= $LIBSOUP3_REQUIRED + libsoup-2.4 >= $LIBSOUP2_REQUIRED + + Please make sure you have the necessary LIBSOUP3 or LIBSOUP2 + development headers installed. + ]) + ]) +]) + AC_SUBST(LIBSOUP_CFLAGS) AC_SUBST(LIBSOUP_LIBS) diff --git a/libgstd/gstd_http.c b/libgstd/gstd_http.c index bbc5c9b2..5149ab2b 100644 --- a/libgstd/gstd_http.c +++ b/libgstd/gstd_http.c @@ -36,10 +36,16 @@ GST_DEBUG_CATEGORY_STATIC (gstd_http_debug); #define GSTD_DEBUG_DEFAULT_LEVEL GST_LEVEL_INFO +#if SOUP_CHECK_VERSION(3,0,0) +typedef SoupServerMessage SoupMsg; +#else +typedef SoupMessage SoupMsg; +#endif + typedef struct _GstdHttpRequest { SoupServer *server; - SoupServerMessage *msg; + SoupMsg *msg; GstdSession *session; const char *path; GHashTable *query; @@ -73,17 +79,17 @@ static GstdReturnCode gstd_http_stop (GstdIpc * base); static gboolean gstd_http_init_get_option_group (GstdIpc * base, GOptionGroup ** group); static SoupStatus get_status_code (GstdReturnCode ret); -static GstdReturnCode do_get (SoupServer * server, SoupServerMessage * msg, +static GstdReturnCode do_get (SoupServer * server, SoupMsg * msg, char **output, const char *path, GstdSession * session); -static GstdReturnCode do_post (SoupServer * server, SoupServerMessage * msg, +static GstdReturnCode do_post (SoupServer * server, SoupMsg * msg, char *name, char *description, char **output, const char *path, GstdSession * session); -static GstdReturnCode do_put (SoupServer * server, SoupServerMessage * msg, +static GstdReturnCode do_put (SoupServer * server, SoupMsg * msg, char *name, char **output, const char *path, GstdSession * session); -static GstdReturnCode do_delete (SoupServer * server, SoupServerMessage * msg, +static GstdReturnCode do_delete (SoupServer * server, SoupMsg * msg, char *name, char **output, const char *path, GstdSession * session); static void do_request (gpointer data_request, gpointer eval); -static void server_callback (SoupServer * server, SoupServerMessage * msg, +static void server_callback (SoupServer * server, SoupMsg * msg, const char *path, GHashTable * query, gpointer data); static void @@ -167,7 +173,7 @@ get_status_code (GstdReturnCode ret) } static GstdReturnCode -do_get (SoupServer * server, SoupServerMessage * msg, char **output, const char *path, +do_get (SoupServer * server, SoupMsg * msg, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -188,7 +194,7 @@ do_get (SoupServer * server, SoupServerMessage * msg, char **output, const char } static GstdReturnCode -do_post (SoupServer * server, SoupServerMessage * msg, char *name, +do_post (SoupServer * server, SoupMsg * msg, char *name, char *description, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -223,7 +229,7 @@ do_post (SoupServer * server, SoupServerMessage * msg, char *name, } static GstdReturnCode -do_put (SoupServer * server, SoupServerMessage * msg, char *name, char **output, +do_put (SoupServer * server, SoupMsg * msg, char *name, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -253,7 +259,7 @@ do_put (SoupServer * server, SoupServerMessage * msg, char *name, char **output, } static GstdReturnCode -do_delete (SoupServer * server, SoupServerMessage * msg, char *name, +do_delete (SoupServer * server, SoupMsg * msg, char *name, char **output, const char *path, GstdSession * session) { gchar *message = NULL; @@ -293,7 +299,7 @@ do_request (gpointer data_request, gpointer eval) const gchar *description = NULL; SoupStatus status = SOUP_STATUS_OK; SoupServer *server = NULL; - SoupServerMessage *msg = NULL; + SoupMsg *msg = NULL; GstdSession *session = NULL; const char *path = NULL; GHashTable *query = NULL; @@ -315,8 +321,11 @@ do_request (gpointer data_request, gpointer eval) name = g_hash_table_lookup (query, "name"); description_pipe = g_hash_table_lookup (query, "description"); } - +#if SOUP_CHECK_VERSION(3,0,0) method = soup_server_message_get_method (msg); +#else + method = msg->method; +#endif if (method == SOUP_METHOD_GET) { ret = do_get (server, msg, &output, path, session); } else if (method == SOUP_METHOD_POST) { @@ -337,15 +346,30 @@ do_request (gpointer data_request, gpointer eval) g_free (output); output = NULL; +#if SOUP_CHECK_VERSION(3,0,0) soup_server_message_set_response (msg, "application/json", SOUP_MEMORY_COPY, response, strlen (response)); +#else + soup_message_set_response (msg, "application/json", SOUP_MEMORY_COPY, + response, strlen (response)); +#endif g_free (response); response = NULL; status = get_status_code (ret); +#if SOUP_CHECK_VERSION(3,2,0) soup_server_message_set_status (msg, status, NULL); g_mutex_lock (data_request_local->mutex); soup_server_message_unpause (msg); +#elif SOUP_CHECK_VERSION(3,0,0) + soup_server_message_set_status (msg, status, NULL); + g_mutex_lock (data_request_local->mutex); + soup_server_unpause_message (server, msg); +#else + soup_message_set_status (msg, status); + g_mutex_lock (data_request_local->mutex); + soup_server_unpause_message (server, msg); +#endif g_mutex_unlock (data_request_local->mutex); if (query != NULL) { @@ -358,9 +382,8 @@ do_request (gpointer data_request, gpointer eval) } static void -server_callback (SoupServer * server, SoupServerMessage * msg, - const char *path, GHashTable * query, - gpointer data) +server_callback (SoupServer * server, SoupMsg * msg, + const char *path, GHashTable * query, gpointer data) { GstdSession *session = NULL; GstdHttp *self = NULL; @@ -387,7 +410,12 @@ server_callback (SoupServer * server, SoupServerMessage * msg, } data_request->mutex = &self->mutex; + +#if SOUP_CHECK_VERSION(3,0,0) response_headers = soup_server_message_get_request_headers (msg); +#else + response_headers = msg->response_headers; +#endif soup_message_headers_append (response_headers, "Access-Control-Allow-Origin", "*"); soup_message_headers_append (response_headers, @@ -395,7 +423,11 @@ server_callback (SoupServer * server, SoupServerMessage * msg, soup_message_headers_append (response_headers, "Access-Control-Allow-Methods", "PUT, GET, POST, DELETE"); g_mutex_lock (&self->mutex); +#if SOUP_CHECK_VERSION(3,2,0) soup_server_message_pause (msg); +#else + soup_server_pause_message (server, msg); +#endif g_mutex_unlock (&self->mutex); if (!g_thread_pool_push (self->pool, (gpointer) data_request, NULL)) { GST_ERROR_OBJECT (self->pool, "Thread pool push failed"); diff --git a/meson.build b/meson.build index 2d41645c..02009526 100644 --- a/meson.build +++ b/meson.build @@ -27,9 +27,13 @@ json_glib_dep = dependency('json-glib-1.0', version : '>=0.16.2') libd_dep = dependency('libdaemon', version : '>=0.14') jansson_dep = dependency('jansson', version : '>=2.7') thread_dep = dependency('threads') -libsoup_dep = dependency('libsoup-3.0', version : '>=2.99') libedit_dep = dependency('libedit', version : '>=3.0') +libsoup_dep = dependency('libsoup-3.0', version : '>=2.99', required: false) +if not libsoup_dep.found() + libsoup_dep = dependency('libsoup-2.4', version : '>=2.4') +endif + gst_check_required = get_option('enable-tests').enabled() gst_check_dep = dependency('gstreamer-check-1.0', required : gst_check_required, version : '>=1.0.5') @@ -46,55 +50,55 @@ gstd_deps = [ # Define gst client library dependencies libgstc_deps = [ - gst_base_dep, - json_glib_dep, - jansson_dep, + gst_base_dep, + json_glib_dep, + jansson_dep, thread_dep ] # Define gst core library dependencies libgstd_deps = [ - gst_base_dep, - gio_unix_dep, - json_glib_dep, - jansson_dep, - thread_dep, + gst_base_dep, + gio_unix_dep, + json_glib_dep, + jansson_dep, + thread_dep, libsoup_dep ] # Define gst client application dependencies gst_client_deps = [ libedit_dep, - json_glib_dep, + json_glib_dep, gio_unix_dep ] # Define test dependencies test_libgstc_deps=[ - gst_base_dep, - json_glib_dep, - jansson_dep, - thread_dep, + gst_base_dep, + json_glib_dep, + jansson_dep, + thread_dep, gst_check_dep ] test_gstd_deps=[ - gst_base_dep, - gio_unix_dep, - json_glib_dep, - libd_dep, - jansson_dep, + gst_base_dep, + gio_unix_dep, + json_glib_dep, + libd_dep, + jansson_dep, gst_check_dep ] test_libgstd_deps=[ - gst_base_dep, - gio_unix_dep, - json_glib_dep, - libd_dep, - jansson_dep, - thread_dep, - libsoup_dep, + gst_base_dep, + gio_unix_dep, + json_glib_dep, + libd_dep, + jansson_dep, + thread_dep, + libsoup_dep, gst_check_dep ] From e9de2c4c4710558c73ae4723fdd9f2364a0bbc01 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Wed, 20 Aug 2025 17:31:04 -0600 Subject: [PATCH 03/12] Add warning for libsoup2.4 --- configure.ac | 23 +++++++++++++---------- meson.build | 3 ++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index d6583ca6..a2aa9f64 100644 --- a/configure.ac +++ b/configure.ac @@ -91,19 +91,22 @@ PKG_CHECK_MODULES(GST, [ PKG_CHECK_MODULES([LIBSOUP], [libsoup-3.0 >= 3.0], [ AC_DEFINE([HAVE_LIBSOUP3], [1], [Define if libsoup3 exists.]) -], [ - PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= 2.4], [ - AC_DEFINE([HAVE_LIBSOUP2], [1], [Define if libsoup2 exists.]) ], [ - AC_MSG_ERROR([ - Can't find the following LIBSOUP development packages: + PKG_CHECK_MODULES([LIBSOUP], [libsoup-2.4 >= 2.4], [ + AC_MSG_WARN(libsoup-2.4 detected: this library will be deprecated in upcoming releases. + Consider migrating to libsoup-3.0.) + ], [ + AC_DEFINE([HAVE_LIBSOUP2], [1], [Define if libsoup2 exists.]) + ], [ + AC_MSG_ERROR([ + Can't find any of the following LIBSOUP development packages: - libsoup-3.0 >= $LIBSOUP3_REQUIRED - libsoup-2.4 >= $LIBSOUP2_REQUIRED + libsoup-3.0 >= $LIBSOUP3_REQUIRED + libsoup-2.4 >= $LIBSOUP2_REQUIRED (to be deprecated in incoming releases) - Please make sure you have the necessary LIBSOUP3 or LIBSOUP2 - development headers installed. - ]) + Please make sure you have the necessary LIBSOUP3 or LIBSOUP2 + development headers installed. + ]) ]) ]) diff --git a/meson.build b/meson.build index 02009526..21190706 100644 --- a/meson.build +++ b/meson.build @@ -29,9 +29,10 @@ jansson_dep = dependency('jansson', version : '>=2.7') thread_dep = dependency('threads') libedit_dep = dependency('libedit', version : '>=3.0') -libsoup_dep = dependency('libsoup-3.0', version : '>=2.99', required: false) +libsoup_dep = dependency('libsoup-3.0', version : '>=3.0', required: false) if not libsoup_dep.found() libsoup_dep = dependency('libsoup-2.4', version : '>=2.4') + warning('libsoup-2.4 detected; this will be deprecated in upcoming releases. Please migrate to libsoup-3.0.') endif gst_check_required = get_option('enable-tests').enabled() From 08a874e8f3958cb48abbf1a349c0c15631e9f3d5 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Thu, 21 Aug 2025 16:17:27 -0600 Subject: [PATCH 04/12] Factor out mutex lock --- libgstd/gstd_http.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libgstd/gstd_http.c b/libgstd/gstd_http.c index 5149ab2b..11ab7aac 100644 --- a/libgstd/gstd_http.c +++ b/libgstd/gstd_http.c @@ -357,20 +357,20 @@ do_request (gpointer data_request, gpointer eval) response = NULL; status = get_status_code (ret); -#if SOUP_CHECK_VERSION(3,2,0) - soup_server_message_set_status (msg, status, NULL); - g_mutex_lock (data_request_local->mutex); - soup_server_message_unpause (msg); -#elif SOUP_CHECK_VERSION(3,0,0) + +#if SOUP_CHECK_VERSION(3,0,0) soup_server_message_set_status (msg, status, NULL); - g_mutex_lock (data_request_local->mutex); - soup_server_unpause_message (server, msg); #else soup_message_set_status (msg, status); +#endif + g_mutex_lock (data_request_local->mutex); + +#if SOUP_CHECK_VERSION(3,2,0) + soup_server_message_unpause (msg); +#else soup_server_unpause_message (server, msg); #endif - g_mutex_unlock (data_request_local->mutex); if (query != NULL) { g_hash_table_unref (query); From e5140f1efc528cc2e611b8afc5952d604664bd7b Mon Sep 17 00:00:00 2001 From: Kimberly Date: Mon, 25 Aug 2025 14:53:18 -0600 Subject: [PATCH 05/12] Fix missing mutex_unlock --- libgstd/gstd_http.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libgstd/gstd_http.c b/libgstd/gstd_http.c index 11ab7aac..ca88e4d7 100644 --- a/libgstd/gstd_http.c +++ b/libgstd/gstd_http.c @@ -371,6 +371,7 @@ do_request (gpointer data_request, gpointer eval) #else soup_server_unpause_message (server, msg); #endif + g_mutex_unlock (data_request_local->mutex); if (query != NULL) { g_hash_table_unref (query); From 1124525b406c6c2e0e6ef8ae7c7a1a1c76bd88dc Mon Sep 17 00:00:00 2001 From: Kimberly Date: Thu, 23 Oct 2025 08:39:19 -0600 Subject: [PATCH 06/12] Modify CI config for Ubuntu 20.04 tests --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9488ff2a..3c416c5c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,8 @@ jobs: - os: ubuntu-22.04 remove-unwind: fix-unwind - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + container: ${{ matrix.os }} steps: - uses: actions/checkout@v2 @@ -59,7 +60,8 @@ jobs: - os: ubuntu-22.04 remove-unwind: fix-unwind - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest + container: ${{ matrix.os }} steps: - uses: actions/checkout@v2 From 8c760ae2cef9207e06f01dc5f0fdedb2104034e9 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Mon, 24 Nov 2025 12:07:47 -0600 Subject: [PATCH 07/12] Change matrix ubuntu version --- .github/workflows/main.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3c416c5c..5462986e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,19 +14,14 @@ jobs: strategy: fail-fast: false matrix: - os: - - ubuntu-20.04 - include: - - os: ubuntu-22.04 - remove-unwind: fix-unwind + ubuntu_version: [ "20.04", "22.04", "24.04" ] - runs-on: ubuntu-latest - container: ${{ matrix.os }} + runs-on: ubuntu-24.04 + container: + image: ubuntu:${{ matrix.ubuntu_version }} steps: - uses: actions/checkout@v2 - - if: ${{ matrix.remove-unwind }} - run: sudo apt remove libunwind-14-dev - name: Dependecies run: | sudo apt update @@ -54,19 +49,14 @@ jobs: strategy: fail-fast: false matrix: - os: - - ubuntu-20.04 - include: - - os: ubuntu-22.04 - remove-unwind: fix-unwind + ubuntu_version: [ "20.04", "22.04", "24.04" ] - runs-on: ubuntu-latest - container: ${{ matrix.os }} + runs-on: ubuntu-24.04 + container: + image: ubuntu:${{ matrix.ubuntu_version }} steps: - uses: actions/checkout@v2 - - if: ${{ matrix.remove-unwind }} - run: sudo apt remove libunwind-14-dev - name: Dependecies run: | sudo apt update From 6b547b26f66a26a5a91dba52124a564da80ac7da Mon Sep 17 00:00:00 2001 From: Kimberly Date: Mon, 24 Nov 2025 12:28:41 -0600 Subject: [PATCH 08/12] Remove sudo in CI --- .github/workflows/main.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5462986e..cb94d5cd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,10 +24,10 @@ jobs: - uses: actions/checkout@v2 - name: Dependecies run: | - sudo apt update - sudo apt install automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev - sudo apt install libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev + apt update + apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev + apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev - name: Generate run: ./autogen.sh - name: Configure @@ -37,7 +37,7 @@ jobs: - name: Checks run: make check - name: Install - run: sudo make install + run: make install - name: Check pygstc installation run: python3 -c "import pygstc" - name: List Pipelines Verification @@ -59,12 +59,12 @@ jobs: - uses: actions/checkout@v2 - name: Dependecies run: | - sudo apt update - sudo apt install automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev - sudo apt install libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - sudo apt install libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev - sudo apt install ninja-build python3-wheel - sudo pip3 install meson + apt update + apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev + apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev + apt install -y ninja-build python3-wheel + pip3 install meson - name: Generate for Ubuntu 20.04 and above run: meson --werror build -Dpython.install_env=auto @@ -73,7 +73,7 @@ jobs: - name: Checks run: ninja -C build test - name: Install - run: sudo ninja -C build install + run: ninja -C build install - name: Check pygstc installation run: python3 -c "import pygstc" - name: List Pipelines Verification From b37b6db81576fa514a481dd2d5cdc288f7ca3001 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Tue, 2 Dec 2025 14:21:13 -0600 Subject: [PATCH 09/12] Fix interactive mode in CI --- .github/workflows/main.yml | 150 +++++++++++++++++++------------------ 1 file changed, 76 insertions(+), 74 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cb94d5cd..3dee747e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,82 +1,84 @@ -name: gstd CI + name: gstd CI -on: - push: - branches: - - master - - develop - pull_request: - branches: - - develop + on: + push: + branches: + - master + - develop + pull_request: + branches: + - develop -jobs: - autotools: - strategy: - fail-fast: false - matrix: - ubuntu_version: [ "20.04", "22.04", "24.04" ] + jobs: + autotools: + strategy: + fail-fast: false + matrix: + ubuntu_version: [ "20.04", "22.04", "24.04" ] - runs-on: ubuntu-24.04 - container: - image: ubuntu:${{ matrix.ubuntu_version }} + runs-on: ubuntu-24.04 + container: + image: ubuntu:${{ matrix.ubuntu_version }} - steps: - - uses: actions/checkout@v2 - - name: Dependecies - run: | - apt update - apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev - apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev - - name: Generate - run: ./autogen.sh - - name: Configure - run: ./configure CFLAGS=-Werror - - name: Compile - run: make - - name: Checks - run: make check - - name: Install - run: make install - - name: Check pygstc installation - run: python3 -c "import pygstc" - - name: List Pipelines Verification - run: | - gstd -e - gstd-client list_pipelines + steps: + - uses: actions/checkout@v2 + - name: Dependecies + run: | + export DEBIAN_FRONTEND=noninteractive + apt update + apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev + apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev + - name: Generate + run: ./autogen.sh + - name: Configure + run: ./configure CFLAGS=-Werror + - name: Compile + run: make + - name: Checks + run: make check + - name: Install + run: make install + - name: Check pygstc installation + run: python3 -c "import pygstc" + - name: List Pipelines Verification + run: | + gstd -e + gstd-client list_pipelines - meson: - strategy: - fail-fast: false - matrix: - ubuntu_version: [ "20.04", "22.04", "24.04" ] + meson: + strategy: + fail-fast: false + matrix: + ubuntu_version: [ "20.04", "22.04", "24.04" ] - runs-on: ubuntu-24.04 - container: - image: ubuntu:${{ matrix.ubuntu_version }} + runs-on: ubuntu-24.04 + container: + image: ubuntu:${{ matrix.ubuntu_version }} - steps: - - uses: actions/checkout@v2 - - name: Dependecies - run: | - apt update - apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev - apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev - apt install -y ninja-build python3-wheel - pip3 install meson + steps: + - uses: actions/checkout@v2 + - name: Dependecies + run: | + export DEBIAN_FRONTEND=noninteractive + apt update + apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev + apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev + apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev + apt install -y ninja-build python3-wheel + pip3 install meson - - name: Generate for Ubuntu 20.04 and above - run: meson --werror build -Dpython.install_env=auto - - name: Compile - run: ninja -C build - - name: Checks - run: ninja -C build test - - name: Install - run: ninja -C build install - - name: Check pygstc installation - run: python3 -c "import pygstc" - - name: List Pipelines Verification - run: | - gstd -e - gstd-client list_pipelines + - name: Generate for Ubuntu 20.04 and above + run: meson --werror build -Dpython.install_env=auto + - name: Compile + run: ninja -C build + - name: Checks + run: ninja -C build test + - name: Install + run: ninja -C build install + - name: Check pygstc installation + run: python3 -c "import pygstc" + - name: List Pipelines Verification + run: | + gstd -e + gstd-client list_pipelines From def347daed2a9f565f1403fc5a3f3debf59c49d4 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Tue, 2 Dec 2025 14:21:35 -0600 Subject: [PATCH 10/12] Fix meson installation in CI --- .github/workflows/main.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3dee747e..18e8a7be 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -51,6 +51,9 @@ fail-fast: false matrix: ubuntu_version: [ "20.04", "22.04", "24.04" ] + include: + - ubuntu_version: "24.04" + meson_opts: "-Dpython.install_env=auto" runs-on: ubuntu-24.04 container: @@ -65,11 +68,10 @@ apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev - apt install -y ninja-build python3-wheel - pip3 install meson + apt install -y ninja-build meson - name: Generate for Ubuntu 20.04 and above - run: meson --werror build -Dpython.install_env=auto + run: meson --werror build ${{ matrix.meson_opts }} - name: Compile run: ninja -C build - name: Checks From 0a05ba899a667679d25d5021233771551de8efe6 Mon Sep 17 00:00:00 2001 From: Kimberly Date: Tue, 2 Dec 2025 15:07:06 -0600 Subject: [PATCH 11/12] Add libsoup version selection to CI --- .github/workflows/main.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18e8a7be..90a82ec3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,9 @@ fail-fast: false matrix: ubuntu_version: [ "20.04", "22.04", "24.04" ] + include: + - ubuntu_version: "20.04" + libsoup2: "libsoup2.4-dev" runs-on: ubuntu-24.04 container: @@ -28,7 +31,12 @@ apt update apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev + apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools + if [ "${{ matrix.libsoup2 }}" ]; then + apt install -y libsoup2.4-dev + else + apt install -y libsoup-3.0-dev + fi - name: Generate run: ./autogen.sh - name: Configure @@ -51,9 +59,11 @@ fail-fast: false matrix: ubuntu_version: [ "20.04", "22.04", "24.04" ] - include: + include: - ubuntu_version: "24.04" meson_opts: "-Dpython.install_env=auto" + - ubuntu_version: "20.04" + libsoup2: "libsoup2.4-dev" runs-on: ubuntu-24.04 container: @@ -67,7 +77,12 @@ apt update apt install -y automake libtool pkg-config libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev apt install -y libglib2.0-dev libjson-glib-dev gtk-doc-tools libedit-dev libncursesw5-dev - apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools libsoup-3.0-dev + apt install -y libdaemon-dev libjansson-dev python3-pip python3-setuptools + if [ "${{ matrix.libsoup2 }}" ]; then + apt install -y libsoup2.4-dev + else + apt install -y libsoup-3.0-dev + fi apt install -y ninja-build meson - name: Generate for Ubuntu 20.04 and above From c04a45fd7749c16a598cbc3103bb870245ea37ab Mon Sep 17 00:00:00 2001 From: Kimberly Date: Tue, 6 Jan 2026 16:14:39 -0600 Subject: [PATCH 12/12] Fix callback conditional support --- libgstd/gstd_http.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libgstd/gstd_http.c b/libgstd/gstd_http.c index ca88e4d7..0d3d0658 100644 --- a/libgstd/gstd_http.c +++ b/libgstd/gstd_http.c @@ -89,8 +89,17 @@ static GstdReturnCode do_put (SoupServer * server, SoupMsg * msg, static GstdReturnCode do_delete (SoupServer * server, SoupMsg * msg, char *name, char **output, const char *path, GstdSession * session); static void do_request (gpointer data_request, gpointer eval); + +#if SOUP_CHECK_VERSION(3,0,0) +/* libsoup3: no context argument for server_callback */ static void server_callback (SoupServer * server, SoupMsg * msg, const char *path, GHashTable * query, gpointer data); +#else +/* libsoup2.4: include context argument for server_callback */ +static void server_callback (SoupServer * server, SoupMsg * msg, + const char *path, GHashTable * query, SoupClientContext * context, + gpointer data); +#endif static void gstd_http_class_init (GstdHttpClass * klass) @@ -382,9 +391,18 @@ do_request (gpointer data_request, gpointer eval) return; } +#if SOUP_CHECK_VERSION(3,0,0) +/* libsoup3: no context argument for server_callback */ static void server_callback (SoupServer * server, SoupMsg * msg, const char *path, GHashTable * query, gpointer data) +#else +/* libsoup2.4: include context argument for server_callback */ +static void +server_callback (SoupServer * server, SoupMsg * msg, + const char *path, GHashTable * query, SoupClientContext * context, + gpointer data) +#endif { GstdSession *session = NULL; GstdHttp *self = NULL; @@ -413,8 +431,10 @@ server_callback (SoupServer * server, SoupMsg * msg, #if SOUP_CHECK_VERSION(3,0,0) +/* libsoup3: no context argument for server_callback */ response_headers = soup_server_message_get_request_headers (msg); #else +/* libsoup2.4: include context argument for server_callback */ response_headers = msg->response_headers; #endif soup_message_headers_append (response_headers,