curlhttpsink: Don't set Content-Length to 0 for proxy

The Content-Length header would unconditionally be included when the
proxy property was set. This would result in requests with both
Content-Length and Transfer-Encoding header. Now we rely on the
use-content-length property in the proxy case aswell. This also makes
sure that Content-Type is set correctly, since before that would be
skipped if proxy was used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7935>
This commit is contained in:
Peter Stensson 2024-11-19 07:31:20 +01:00 committed by GStreamer Marge Bot
parent 89c23137d3
commit e9d32abf98
2 changed files with 0 additions and 15 deletions

View file

@ -188,9 +188,7 @@ gst_curl_http_sink_init (GstCurlHttpSink * sink)
sink->discovered_content_type = NULL; sink->discovered_content_type = NULL;
sink->proxy_port = DEFAULT_PROXY_PORT; sink->proxy_port = DEFAULT_PROXY_PORT;
sink->proxy_headers_set = FALSE;
sink->proxy_auth = FALSE; sink->proxy_auth = FALSE;
sink->use_proxy = FALSE;
sink->proxy_conn_established = FALSE; sink->proxy_conn_established = FALSE;
sink->proxy_resp = -1; sink->proxy_resp = -1;
} }
@ -334,13 +332,6 @@ gst_curl_http_sink_set_header_unlocked (GstCurlBaseSink * bcsink)
sink->header_list = NULL; sink->header_list = NULL;
} }
if (!sink->proxy_headers_set && sink->use_proxy) {
sink->header_list = curl_slist_append (sink->header_list,
"Content-Length: 0");
sink->proxy_headers_set = TRUE;
goto set_headers;
}
if (sink->use_content_length) { if (sink->use_content_length) {
/* if content length is used we assume that every buffer is one /* if content length is used we assume that every buffer is one
* entire file, which is the case when uploading several jpegs */ * entire file, which is the case when uploading several jpegs */
@ -375,8 +366,6 @@ gst_curl_http_sink_set_header_unlocked (GstCurlBaseSink * bcsink)
} }
set_headers:
if (bcsink->file_name) { if (bcsink->file_name) {
tmp = g_strdup_printf ("Content-Disposition: attachment; filename=" tmp = g_strdup_printf ("Content-Disposition: attachment; filename="
"\"%s\"", bcsink->file_name); "\"%s\"", bcsink->file_name);
@ -579,7 +568,5 @@ proxy_setup (GstCurlBaseSink * bcsink)
} }
} }
sink->use_proxy = TRUE;
return TRUE; return TRUE;
} }

View file

@ -52,8 +52,6 @@ struct _GstCurlHttpSink
gboolean use_content_length; gboolean use_content_length;
gchar *content_type; gchar *content_type;
gchar *discovered_content_type; gchar *discovered_content_type;
gboolean use_proxy;
gboolean proxy_headers_set;
gboolean proxy_auth; gboolean proxy_auth;
gboolean proxy_conn_established; gboolean proxy_conn_established;
glong proxy_resp; glong proxy_resp;