Commit graph

115 commits

Author SHA1 Message Date
Mathieu Duponchelle
6baffc2931 docs: mark more types as plugin API 2020-06-23 12:10:17 -04:00
Mathieu Duponchelle
a048ce81d4 plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:40:42 +02:00
cketti
2408fbe92d curlsmtpsink: Use correct email date format
See https://www.rfc-editor.org/rfc/rfc5322.html#section-3.3

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1317>
2020-06-05 08:22:34 +00:00
Sebastian Dröge
74f2f733be plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-04 13:33:16 -04:00
Mats Lindestam
bf004227ec gstcurlhttpsink: Set 'Expect: 100-continue'-header
In the upgrade of libcurl from 7.64.1 to 7.69.1 the
EXPECT_100_THRESHOLD has been increased from 1 Kb to 1 Mb
(see https://curl.haxx.se/mail/lib-2020-01/0050.html).
This caused the gstcurlhttpsink to not being able to rewind
and resend in the case, e.g. response '401 Unauthorized'.
Now the 'Expect: 100-continue'-header is explicitly set in
the gstcurlhttpsink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1276>
2020-05-18 13:46:24 +02:00
Ludvig Rappe
2d585f2b0b 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.
2020-02-07 13:24:53 +00:00
Stéphane Cerveau
6bc0e9527e remove various useless linefeed in logs 2019-12-11 10:51:29 +01:00
Linus Svensson
8106fd1a64 curl: Require libcurl 7.55.0
CURLINFO_CONTENT_LENGTH_DOWNLOAD_T is available from libcurl version
7.55.0.
2019-11-20 11:34:15 +01:00
Alex Ashley
e9c68347f0 curlhttpsrc: add support for range GET
To allow curlhttpsrc to support DASH streams that use the on-demand
profile, it needs to support HTTP Range GETs. In GStreamer, the RANGE
is specified by issuing a GST_FORMAT_BYTES seek to set the start and
end of the range. curlhttpsrc needs to implement seek and set the
appropriate curl options to make it add the Range header to the
request.
2019-11-17 14:28:25 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Yeongjin Jeong
a7ec30dc94 curlhttpsrc: Hook up libcurl logging message to gstreamer
CURLOPT_DEBUGFUNCTION option replaces the standard debug function
used when CURLOPT_VERBOSE is in effect. This callback receives various debug information.
2019-11-04 23:14:02 +00:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Mathieu Duponchelle
da6afdec9c doc: remove xml from comments 2019-05-29 22:58:08 +02:00
Thibault Saunier
47a49f3381 docs: Build documentation with hotdoc 2019-05-13 17:00:00 -04:00
Thibault Saunier
5a2b9357c9 Mark some properties as DOC_SHOW_DEFAULT 2019-05-13 11:36:32 -04:00
Thibault Saunier
7fe3f36ac8 Minor documentation fixes 2019-05-13 11:36:27 -04:00
Alex Ashley
dbe0a8cbc3 curlhttpsrc: set BUFFER_OFFSET when creating GstBuffer
To make curlhttpsrc behave more like souphttpsrc, set the
BUFFER_OFFSET in its output buffers to match the segment
start. This means that in a HTTP RANGE request, the BUFFER_OFFSET
will match the value in the RANGE request.
2019-02-19 17:55:13 +00:00
Alex Ashley
2d806477d0 curlhttpsrc: export same HTTP error status as souphttpsrc
To make it closer to a drop-in replacement for souphttpsrc,
expose the same gst_error_message_with_details as souphttpsrc,
so that applications can received the HTTP status code and reason
when an error occurs.
2019-02-19 17:55:12 +00:00
Alex Ashley
c2fe4e58ad curlhttpsrc: fix various leaks and thread safety issues
curlhttpsrc uses a single thread running the
gst_curl_http_src_curl_multi_loop() function to handle receiving
data and messages from libcurl. Each instance of curlhttpsrc adds
an entry into a queue in GstCurlHttpSrcMultiTaskContext and waits
for the multi_loop to perform the HTTP request.

Valgrind has shown up race conditions and memory leaks:
1. gst_curl_http_src_change_state() does not wait for the multi_loop
   to complete before going to the NULL state, which means that
   an instance of GstCurlHttpSrc can be released while
   gst_curl_http_src_curl_multi_loop() still has a reference to it.
2. if multiple elements try to be removed from the queue at once,
   only the last one is deleted.
3. source->caps is leaked
4. curl multi_handle is leaked
5. leak of curl_handle if URI not set
6. leak of http_headers when reusing element
7. null pointer dereference in negotiate caps
8. double-free of the default user-agent string
9. leak of multi_task_context.task

This commit changes the logic so that each element has a connection
status, which is used by the multi_loop to decide when to remove an
element from its queue. An instance of curlhttpsrc will not enter
the NULL state until its reference has been removed from the queue.

When shutting down the curl multi loop, the memory allocated from the
call to curl_multi_init() is now released.

When gstadaptivedemux uses a URI source element, it will re-use
it for multiple requests, moving it between READY and PLAYING
between each request. curlhttpsrc was leaking the http_headers
structure in this use case.

The gst_curl_http_src_negotiate_caps() function extracts the
"response-headers" field from the http_headers, but did not check
that this field might be NULL.

If the user-agent property is set, the global user-agent string
was freed. This caused a double-free error if the user-agent is
ever set a second time during the execution of the process.

There are situations within curlhttpsrc where the code needs
both the global multi_task_context mutex and the per-element
buffer_mutex. To avoid deadlocks, it is vital that the order in
which these are requested is always the same. This commit modifies
the locking order to always be in the order:
 1. multi_task_context.task_rec_mutex
 2. buffer_mutex

Fixes #876
2019-02-19 17:55:12 +00:00
Jonathan Karlsson
d49bc71f00 curlhttpsink: free content type before assigning it
Not doing this would result in a memory leak.
2018-12-17 15:56:08 +00:00
Jonathan Karlsson
e8ec1c0143 curlbasesink: cleanup transfer immediately when done 2018-12-17 14:24:07 +00:00
Patricia Muscalu
e0adbee49a curlbasesink: Rename curl transfer thread
Some systems restrict the length of thread names to 16 bytes.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/838
2018-12-06 15:36:47 +00:00
Jonathan Karlsson
b025736899 curlhttpsink: Enable content type changes
Makes it possible to change content type without having to
reinitialize the element, typically after reset.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/merge_requests/41
2018-12-06 09:08:59 +00:00
Tim-Philipp Müller
a4cfb1fa14 meson: add 'curl-ssh2' option for curl libssh2 support
https://bugzilla.gnome.org/show_bug.cgi?id=797346
2018-10-28 11:53:42 +00:00
Xavier Claessens
8dfe0dd9ce meson: Use the 'curl' feature option
https://bugzilla.gnome.org/show_bug.cgi?id=797346
2018-10-28 11:51:34 +00:00
Wim Taymans
cb16d0b239 curlhhtpsrc: avoid invalid memory references
gst_curl_http_src_remove_queue_item() can free qelement and then
we get an invalid memory reference when we do qelement->next a
couple of lines below. Take the next pointer earlier so that we can
safely free.
2018-08-16 11:44:27 +02:00
Jonathan Karlsson
d74ceb343a 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
2018-07-17 16:57:06 +03:00
Xavier Claessens
83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Jun Xie
cb1b143b5b curlhttpsrc: deadlock in multi-instance scenario
Fixed queue iterator issue and set context state to
GSTCURL_MULTI_LOOP_STATE_RUNNING in case other
instance are in running state.

https://bugzilla.gnome.org/show_bug.cgi?id=793863
2018-04-24 14:18:20 -04:00
Tim-Philipp Müller
cfe030ad1b meosn: curl: also check for and use libssh2 if available 2018-01-22 18:55:06 +00:00
Edward Hervey
8d99867c13 curlhttpsrc: Don't leak structure
CID #1415716
2017-11-22 16:58:11 +01:00
Tim-Philipp Müller
16294a147e curl: fix meson build
Include libsdir so our i18n header there is found.
2017-11-21 20:56:38 +01:00
Edward Hervey
d4afba794a curlhttpsrc: Post an error message if no URI was set
Like for other sources
2017-11-21 16:30:35 +01:00
Edward Hervey
69d794b004 curl: Add i18n 2017-11-21 16:30:17 +01:00
Edward Hervey
26108d829b curlhttpsrc: Fix return value
The function returns a gchar * (and not a boolean)
2017-11-21 15:33:08 +01:00
Edward Hervey
b8cb08c319 curlhttpsrc: Don't switch to PAUSED if not URI was specified
Like for other sources
2017-11-21 15:31:05 +01:00
Alex Ashley
048d703577 curlhttpsrc: set http-version default if curl does not have HTTP2 feature present
If the version of the curl library is recent enough to allow support
for HTTP2 (i.e. CURL_VERSION_HTTP2 is defined) but does not actually
have that feature enabled, the call to
g_object_class_install_property() uses an incorrect default value for
the "http-version" property. The default should be 1.1 if HTTP2 is
not supported by libcurl or if not enabled by libcurl.

https://bugzilla.gnome.org/show_bug.cgi?id=786049
2017-08-09 17:59:31 +03:00
Sam Hurst
6baa66a889 curlhttpsrc: Does version set fail because of HTTP2
Check to see if setting CURL_HTTP_VERSION_2_0 failed due to lack of HTTP/2
support or some bigger underlying libcurl failure

https://bugzilla.gnome.org/show_bug.cgi?id=785878
2017-08-08 09:06:49 +01:00
Philippe Normand
5bf092bd64 curlhttpsrc: set http-version class property as enum
This matches better with the preferred_http_version which was already declared
as enum.

https://bugzilla.gnome.org/show_bug.cgi?id=785878
2017-08-08 09:06:49 +01:00
Reynaldo H. Verdejo Pinochet
aa1b530f66 curl: curlqueue: add symbol name to avoid confusing gtkdoc 2017-07-26 17:22:31 -07:00
Reynaldo H. Verdejo Pinochet
d82ae7a45f curlhttpsrc: do not check for NULL before g_free()
g_free() is NULL-safe.
2017-07-26 16:51:50 -07:00
Sam Hurst
85eb69d717 curlhttpsrc: Fix flagged Coverity errors
Fixes CIDs 1415707 - 1415717
2017-07-26 23:16:10 +03:00
Sam Hurst
b922edce7b curl: Reorganise header files to fix macOS builds
https://bugzilla.gnome.org/show_bug.cgi?id=744261
2017-07-26 18:57:38 +01:00
Edward Hervey
07afe5da0c curlhttpsrc: Fix compilation without debugging system enabled 2017-07-26 09:19:42 +02:00
Sam Hurst
e74b3a02dd curl: Add curlhttpsrc element
Merged from https://github.com/bbc/gst-curlhttpsrc commit
  f8aabcfc5c50a44f3362de831377d6e86dcd2d49

https://bugzilla.gnome.org/show_bug.cgi?id=744261
2017-07-26 09:52:20 +03:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Imre Eörs
2c3aa2f09c curl: transfer hangs in case connection was cut between client and server
https://bugzilla.gnome.org/show_bug.cgi?id=774485
2016-11-16 09:19:45 +00:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
Sebastian Rasmussen
c7e4217121 curlsmtpsink: Lock and don't send final boundary upon error
Previously GstCurlSmtpSink could cause the pipeline thread to end up
waiting for a stopped thread to perform work.

The scenario was that the sink could be rendering a buffer and waiting
for the curl transfer thread to have sent the data. As soon as the
transfer thread has copied all data to curl's data buffer in
gst_curl_base_sink_transfer_read_cb() then the render call would stop
waiting and return GST_FLOW_OK. While this takes place the transfer
thread may suffer from an error e.g. due gst_poll_wait() timing out.
This causes the transfer thread to record the error, claim (it is not
really true since there was an error) that the data has been sent and
that a response has been received by trying to signal the pipeline
thread (but this has already stopped waiting). Finally the transfer
thread stops itself. A short while later the pipeline thread may attempt
to push an EOS event into GstCurlSmtpSink. Since there is no check in
gst_curl_smtp_sink_event() to check if the sink has suffered from any
error it may attempt to add a final boundary and ask the, now deceased,
transfer thread to transfer the new data. Next the sink element would
have waited for the transfer to complete (using a different mechanism
than normal transfers through GstCurlBaseSink). In this case there was
an error check to avoid waiting if an error had already been seen.
Finally GstCurlSmtpSink would chain up to GstCurlBaseSink which would
then block waiting for a response (normally this would be prevented by
the transfer thread suffering the error claiming that it had been
received, but GstCurlSmtpSink clobbered this flag after the fact).

Now GstCurlSmtpSink avoids this by locking over the entire event handing
(preventing simultaneous changes to flags by the two threads) and also
by avoiding to initiate transfer of final boundary if an error has
already been seen.

Also add GST_FIXME() for remaining similar issue where the pipeline
thread may block indefinitely waiting for transfer thread to transfer
data but the transfer thread errors out and fails to notify the pipeline
thread that the transfer failed.

https://bugzilla.gnome.org/show_bug.cgi?id=767501
2016-06-11 11:25:13 +01:00