curlhttpsink: only add content-disposition header if a filename is set

The header is optional and therefore we better omit it if we don't have a filename.
This commit is contained in:
Stefan Sauer 2014-09-24 22:24:49 +02:00
parent a80cde8cb6
commit 8a8d3ac351

View file

@ -352,10 +352,12 @@ gst_curl_http_sink_set_header_unlocked (GstCurlBaseSink * bcsink)
set_headers:
tmp = g_strdup_printf ("Content-Disposition: attachment; filename="
"\"%s\"", bcsink->file_name);
sink->header_list = curl_slist_append (sink->header_list, tmp);
g_free (tmp);
if (bcsink->file_name) {
tmp = g_strdup_printf ("Content-Disposition: attachment; filename="
"\"%s\"", bcsink->file_name);
sink->header_list = curl_slist_append (sink->header_list, tmp);
g_free (tmp);
}
res = curl_easy_setopt (bcsink->curl, CURLOPT_HTTPHEADER, sink->header_list);
if (res != CURLE_OK) {
bcsink->error = g_strdup_printf ("failed to set HTTP headers: %s",
@ -399,6 +401,7 @@ gst_curl_http_sink_set_options_unlocked (GstCurlBaseSink * bcsink)
parent_class = GST_CURL_TLS_SINK_GET_CLASS (sink);
if (g_str_has_prefix (bcsink->url, "https://")) {
GST_DEBUG_OBJECT (bcsink, "setting up tls options");
return parent_class->set_options_unlocked (bcsink);
}