summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
authorStefan Sauer <ensonic@users.sf.net>2014-10-15 15:25:55 +0200
committerStefan Sauer <ensonic@users.sf.net>2014-10-16 14:12:19 +0200
commit24fd4cd74cf029e293089ac262d8a13e5b6cf32c (patch)
treeb09ddf53f81de679315ecd8dcea498509e62c074 /ext/curl
parent9b459b52f6fedc108a5314b64c620d154bd34307 (diff)
curlbasesink: strip newlines from curl debug messages
The messages we receive in the custom log handler might end with a newline and are not \0 terminated. Copy the messages, trim and terminate them.
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/gstcurlbasesink.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/ext/curl/gstcurlbasesink.c b/ext/curl/gstcurlbasesink.c
index 7766dba34..1654c45a5 100644
--- a/ext/curl/gstcurlbasesink.c
+++ b/ext/curl/gstcurlbasesink.c
@@ -989,16 +989,31 @@ gst_curl_base_sink_debug_cb (CURL * handle, curl_infotype type, char *data,
size_t size, void *clientp)
{
GstCurlBaseSink *sink = (GstCurlBaseSink *) clientp;
+ gchar *msg = NULL;
switch (type) {
case CURLINFO_TEXT:
- GST_DEBUG_OBJECT (sink, "%*s", (int) size, data);
+ case CURLINFO_HEADER_IN:
+ case CURLINFO_HEADER_OUT:
+ msg = g_memdup (data, size);
+ if (size > 0) {
+ msg[size - 1] = '\0';
+ g_strchomp (msg);
+ }
+ break;
+ default:
+ break;
+ }
+
+ switch (type) {
+ case CURLINFO_TEXT:
+ GST_DEBUG_OBJECT (sink, "%s", msg);
break;
case CURLINFO_HEADER_IN:
- GST_DEBUG_OBJECT (sink, "incoming header: %*s", (int) size, data);
+ GST_DEBUG_OBJECT (sink, "incoming header: %s", msg);
break;
case CURLINFO_HEADER_OUT:
- GST_DEBUG_OBJECT (sink, "outgoing header: %*s", (int) size, data);
+ GST_DEBUG_OBJECT (sink, "outgoing header: %s", msg);
break;
case CURLINFO_DATA_IN:
GST_MEMDUMP_OBJECT (sink, "incoming data", (guint8 *) data, size);
@@ -1017,6 +1032,7 @@ gst_curl_base_sink_debug_cb (CURL * handle, curl_infotype type, char *data,
GST_MEMDUMP_OBJECT (sink, "unknown data", (guint8 *) data, size);
break;
}
+ g_free (msg);
return 0;
}
#endif