curlhttpsink: Don't set Content-Length to 0 for proxy
authorPeter Stensson <petest@axis.com>
Tue, 19 Nov 2024 06:31:20 +0000 (07:31 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Mon, 9 Dec 2024 08:40:19 +0000 (08:40 +0000)
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>

subprojects/gst-plugins-bad/ext/curl/gstcurlhttpsink.c
subprojects/gst-plugins-bad/ext/curl/gstcurlhttpsink.h

index 8ae2676a81c81d44c60152e3a56eee12d3254b75..451a9739d85d8b1a311fe284048795b0bee69108 100644 (file)
@@ -188,9 +188,7 @@ gst_curl_http_sink_init (GstCurlHttpSink * sink)
   sink->discovered_content_type = NULL;
 
   sink->proxy_port = DEFAULT_PROXY_PORT;
-  sink->proxy_headers_set = FALSE;
   sink->proxy_auth = FALSE;
-  sink->use_proxy = FALSE;
   sink->proxy_conn_established = FALSE;
   sink->proxy_resp = -1;
 }
@@ -334,13 +332,6 @@ gst_curl_http_sink_set_header_unlocked (GstCurlBaseSink * bcsink)
     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 content length is used we assume that every buffer is one
      * 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) {
     tmp = g_strdup_printf ("Content-Disposition: attachment; filename="
         "\"%s\"", bcsink->file_name);
@@ -579,7 +568,5 @@ proxy_setup (GstCurlBaseSink * bcsink)
     }
   }
 
-  sink->use_proxy = TRUE;
-
   return TRUE;
 }
index d2e6f19d869c912dae46540d2f622fb37bc85cc8..ad3a11a92d3e2094664770d926d7d24e39e1a429 100644 (file)
@@ -52,8 +52,6 @@ struct _GstCurlHttpSink
   gboolean use_content_length;
   gchar *content_type;
   gchar *discovered_content_type;
-  gboolean use_proxy;
-  gboolean proxy_headers_set;
   gboolean proxy_auth;
   gboolean proxy_conn_established;
   glong proxy_resp;