summaryrefslogtreecommitdiff
path: root/ext/curl
diff options
context:
space:
mode:
authorJonathan Karlsson <jonakn@axis.com>2018-06-18 13:01:50 +0200
committerSebastian Dröge <sebastian@centricular.com>2018-07-17 16:57:06 +0300
commitd74ceb343aea60c6f3dea76bb90e7730682c6e8b (patch)
treed3f8be88c0b75832efe01cdca35c7da0ceb79ed9 /ext/curl
parent0af199e25ec7732c7a8462bae4e62219badb313c (diff)
downloadgstreamer-plugins-bad-d74ceb343aea60c6f3dea76bb90e7730682c6e8b.tar.gz
curlhttpsink: Support for multipart/form-data Content-Type
Add support to set multipart/form-data as Content-Type by sending a caps event to the curlhttpsink with a field named "boundary". https://bugzilla.gnome.org/show_bug.cgi?id=796618
Diffstat (limited to 'ext/curl')
-rw-r--r--ext/curl/gstcurlhttpsink.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/ext/curl/gstcurlhttpsink.c b/ext/curl/gstcurlhttpsink.c
index 3df255574..657a40d68 100644
--- a/ext/curl/gstcurlhttpsink.c
+++ b/ext/curl/gstcurlhttpsink.c
@@ -466,7 +466,16 @@ gst_curl_http_sink_set_mime_type (GstCurlBaseSink * bcsink, GstCaps * caps)
structure = gst_caps_get_structure (caps, 0);
mime_type = gst_structure_get_name (structure);
- sink->content_type = g_strdup (mime_type);
+
+ if (!g_strcmp0 (mime_type, "multipart/form-data") &&
+ gst_structure_has_field_typed (structure, "boundary", G_TYPE_STRING)) {
+ const gchar *boundary;
+
+ boundary = gst_structure_get_string (structure, "boundary");
+ sink->content_type = g_strconcat (mime_type, "; boundary=", boundary, NULL);
+ } else {
+ sink->content_type = g_strdup (mime_type);
+ }
}
static gboolean