From c08a0493ff51866cf6e7cb92d513191984ec8aef Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Thu, 19 Jan 2017 12:29:44 +0100 Subject: [PATCH] souphttpsrc: report a useful error message when soup_session_send fails This helps to understand cases where libsoup doesn't set the message status code after running soup_session_send. https://bugzilla.gnome.org/show_bug.cgi?id=777222 --- ext/soup/gstsouphttpsrc.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index c4f70c633..73f9e1c55 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -1413,34 +1413,40 @@ static GstFlowReturn gst_soup_http_src_send_message (GstSoupHTTPSrc * src) { GstFlowReturn ret; + GError *error = NULL; g_return_val_if_fail (src->msg != NULL, GST_FLOW_ERROR); - /* FIXME We are ignoring the GError here, might be useful to debug */ src->input_stream = - soup_session_send (src->session, src->msg, src->cancellable, NULL); + soup_session_send (src->session, src->msg, src->cancellable, &error); - if (g_cancellable_is_cancelled (src->cancellable)) - return GST_FLOW_FLUSHING; + if (g_cancellable_is_cancelled (src->cancellable)) { + ret = GST_FLOW_FLUSHING; + goto done; + } ret = gst_soup_http_src_got_headers (src, src->msg); if (ret != GST_FLOW_OK) { - return ret; + goto done; } if (!src->input_stream) { - GST_DEBUG_OBJECT (src, "Didn't get an input stream"); - return GST_FLOW_ERROR; + GST_DEBUG_OBJECT (src, "Didn't get an input stream: %s", error->message); + ret = GST_FLOW_ERROR; + goto done; } if (SOUP_STATUS_IS_SUCCESSFUL (src->msg->status_code)) { GST_DEBUG_OBJECT (src, "Successfully got a reply"); } else { /* FIXME - be more helpful to people debugging */ - return GST_FLOW_ERROR; + ret = GST_FLOW_ERROR; } - return GST_FLOW_OK; +done: + if (error) + g_error_free (error); + return ret; } static GstFlowReturn -- GitLab