From 54eff61f0f235cc3d6216158ef16b59d758f8e34 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 26 Mar 2022 00:59:12 +0530 Subject: [PATCH] soup: Fix usage of symbols / defines that are gone in libsoup3 I am not sure about the SOUP_MESSAGE_OVERWRITE_CHUNKS change, but it was definitely already broken when using libsoup-3.0 in a shared build. souphttpsrc probably needs to be ported from SoupMessage to SoupServerMessage when using libsoup-3.0. Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1111 Part-of: --- .../gst-plugins-good/ext/soup/gstsouphttpsrc.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c b/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c index 7204c1b..30d2f79 100644 --- a/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c +++ b/subprojects/gst-plugins-good/ext/soup/gstsouphttpsrc.c @@ -1014,11 +1014,14 @@ thread_func (gpointer user_data) NULL); g_object_unref (proxy_resolver); } +#if !defined(STATIC_SOUP) || STATIC_SOUP == 2 } else { g_object_set (session->session, "ssl-strict", src->ssl_strict, NULL); if (src->proxy != NULL) { + /* Need #if because there's no proxy->soup_uri when STATIC_SOUP == 3 */ g_object_set (session->session, "proxy-uri", src->proxy->soup_uri, NULL); } +#endif } gst_soup_util_log_setup (session->session, src->log_level, @@ -1612,6 +1615,8 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) return GST_FLOW_OK; } + /* SOUP_STATUS_IS_TRANSPORT_ERROR was replaced with GError in libsoup-3.0 */ +#if !defined(STATIC_SOUP) || STATIC_SOUP == 2 if (SOUP_STATUS_IS_TRANSPORT_ERROR (status_code)) { switch (status_code) { case SOUP_STATUS_CANT_RESOLVE: @@ -1647,6 +1652,7 @@ gst_soup_http_src_parse_status (SoupMessage * msg, GstSoupHTTPSrc * src) } return GST_FLOW_OK; } +#endif if (SOUP_STATUS_IS_CLIENT_ERROR (status_code) || SOUP_STATUS_IS_REDIRECTION (status_code) || @@ -1770,8 +1776,20 @@ gst_soup_http_src_build_message (GstSoupHTTPSrc * src, const gchar * method) G_CALLBACK (gst_soup_http_src_authenticate_cb), src); } - _soup_message_set_flags (src->msg, SOUP_MESSAGE_OVERWRITE_CHUNKS | - (src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT)); + { + SoupMessageFlags flags = + src->automatic_redirect ? 0 : SOUP_MESSAGE_NO_REDIRECT; + + /* SOUP_MESSAGE_OVERWRITE_CHUNKS is gone in libsoup-3.0, and + * soup_message_body_set_accumulate() requires SoupMessageBody, which + * can only be fetched from SoupServerMessage, not SoupMessage */ +#if !defined(STATIC_SOUP) || STATIC_SOUP == 2 + if (gst_soup_loader_get_api_version () == 2) + flags |= SOUP_MESSAGE_OVERWRITE_CHUNKS; +#endif + + _soup_message_set_flags (src->msg, flags); + } if (src->automatic_redirect) { g_signal_connect (src->msg, "restarted", -- 2.7.4