curlhttpsink: HTTP code in transfer error details

There is currently no easy way for an application to distinguish between
different resource write errors being set in the curlhttpsink.
Add HTTP status code as error details on transfer failure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4062>
This commit is contained in:
Erik Fröbrant 2023-02-23 14:26:27 +00:00 committed by GStreamer Marge Bot
parent b41a5d3ccb
commit 8f094a1cc8

View file

@ -450,8 +450,9 @@ gst_curl_http_sink_transfer_verify_response_code (GstCurlBaseSink * bcsink)
GST_DEBUG_OBJECT (sink, "response code: %ld", resp);
if (resp < 100 || resp >= 300) {
bcsink->error = g_strdup_printf ("HTTP response error: (received: %ld)",
resp);
GST_ELEMENT_ERROR_WITH_DETAILS (sink, RESOURCE, WRITE,
("HTTP response error code: %ld", resp), (NULL), ("http-status-code",
G_TYPE_UINT, (guint) resp, NULL));
return FALSE;
}