mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
gstcurlhttpsink: Update HTTP header for curl 7.66
Change how content-length is set for HTTP POST headers, letting curl set the header (given the content-length) instead of manually writing it. This enables curl to know the content-length of the data. In curl 7.66, if curl does not know the content-length (e.g. when manually writing the header) curl will use Transfer-Encoding: chunked, which might not be desired.
This commit is contained in:
parent
3ca87d9988
commit
2d585f2b0b
1 changed files with 8 additions and 4 deletions
|
@ -335,10 +335,14 @@ gst_curl_http_sink_set_header_unlocked (GstCurlBaseSink * bcsink)
|
||||||
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 */
|
||||||
tmp =
|
res =
|
||||||
g_strdup_printf ("Content-Length: %d", (int) bcsink->transfer_buf->len);
|
curl_easy_setopt (bcsink->curl, CURLOPT_POSTFIELDSIZE,
|
||||||
sink->header_list = curl_slist_append (sink->header_list, tmp);
|
(long) bcsink->transfer_buf->len);
|
||||||
g_free (tmp);
|
if (res != CURLE_OK) {
|
||||||
|
bcsink->error = g_strdup_printf ("failed to set HTTP content-length: %s",
|
||||||
|
curl_easy_strerror (res));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* when sending a POST request to a HTTP 1.1 server, you can send data
|
/* when sending a POST request to a HTTP 1.1 server, you can send data
|
||||||
* without knowing the size before starting the POST if you use chunked
|
* without knowing the size before starting the POST if you use chunked
|
||||||
|
|
Loading…
Reference in a new issue