Use send() instead of write() so that we can pass the MSG_NOSIGNAL flags to
avoid crashing with SIGPIPE when the remote end is not listening to us anymore.
Fixes#601772
I also renamed glib_enum_prefix to glib_gen_prefix as we also use that for the
marshallers. Also rename the rtsp-marshal.list to work with the unified prefix.
gstrtspconnection.c:gst_rtsp_connection_receive() can hang when an error occured
on a socekt. Fix this problem by checking for error on 'other' socket after poll
return.
Fixes#596159
The new API to send messages using GstRTSPWatch will first try to send the
message immediately. Then, if that failed (or the message was not sent
fully), it will queue the remaining message for later delivery. This avoids
unnecessary context switches, and makes it possible to keep track of
whether the connection is blocked (the unblocking of the connection is
indicated by the reception of the message_sent signal).
This also deprecates the old API (gst_rtsp_watch_queue_data() and
gst_rtsp_watch_queue_message().)
API: gst_rtsp_watch_write_data()
API: gst_rtsp_watch_send_message()
With gst_rtsp_connection_set_http_mode() it is possible to tell the
connection whether to allow HTTP messages to be supported. By enabling HTTP
support the automatic HTTP tunnel support will also be disabled.
API: gst_rtsp_connection_set_http_mode()
The error_full callback is similar to the error callback, but allows for
better error handling. For read errors a partial message is provided to
help an RTSP server generate a more correct error response, and for write
errors the write queue id of the failed message is returned.
Rewrote read_line() to support LWS (Line White Space), the method used by
RTSP (and HTTP) to break long lines. Also added support for \r and \n as
line endings (in addition to the official \r\n).
From RFC 2068 section 4.2: "Multiple message-header fields with the same
field-name may be present in a message if and only if the entire
field-value for that header field is defined as a comma-separated list
[i.e., #(values)]." This means that we should not split other headers which
may contain a comma, e.g., Range and Date.
Due to the odd syntax for WWW-Authenticate (and Proxy-Authenticate) which
allows commas both to separate between multiple challenges, and within the
challenges themself, we need to take some extra care to split these headers
correctly.
Do not abort message parsing as soon as there is an error. Instead parse
as much as possible to allow a server to return as meaningful an error as
possible.
Remove any existing Session and Date headers before adding new ones
when sending a request. This may happen if the user of this code reuses
a request (rtspsrc does this when resending after authorization fails).
Do not use sizeof() on an array passed as an argument to a function and
expect to get anything but the size of a pointer. As a result only the
first 4 (or 8) bytes of the response buffer were initialized to 0 in
auth_digest_compute_response() which caused it to return a string which
was not NUL-terminated...
gst_rtsp_watch_queue_data() is similar to gst_rtsp_watch_queue_message()
but allows for queuing any data block for writing (much like
gst_rtsp_connection_write() vs. gst_rtsp_connection_send().)
API: gst_rtsp_watch_queue_data()
The base64 decoding in fill_bytes() expected the size of the read data to
be evenly divisible by four (which is true for the base64 encoded data
itself). This did not, however, take whitespace (especially line breaks)
into account and would fail the decoding if any whitespace was present.
Previously the messages_sent() callback was only called for messages
which had a CSeq, which excluded all data messages. Instead of using the
CSeq as ID, use a simple index counter.
People might queue messages from a thread other than the thread in which
the main context which this watch is attached is iterated from, so use
a GAsyncQueue instead of a GList, so g_list_append() doesn't trample
over list nodes just freed in the other thread. This just fixes issues
I've had with gst-rtsp-server. We might need more locking in various
places here.
We were returning a pointer to a stack variable with the resolved hostname,
which doesn't work.
return a copy of the resolved ip address instead.
Fixes#575256.
Free the key value before we remove the header item from the array. The item we
retrieved from the array is only valid until we remove it from the array.
Save the tunnelid in the connection. Add a method to retrieve the tunnelid so
that a server can store and match the id against other tunnel requests.
Fix the URI in the tunnel requests so that they contain the absolute uri and the
query string if any instead of just the hostname.
Transparently base64 decode the input stream when tunneling.
Add method to set the connection ip address so that it can be included in the
tunnel response.
Add method to connect the two tunnel requests.
Add two callbacks for the async mode to notify a tunnel start and tunnel
complete event.
Add method to reset the watch after the connection has been tunneled.
Various little refactoring to make more stuff reusable.
API: RTSP::gst_rtsp_connection_set_ip()
API: RTSP::gst_rtsp_connection_get_tunnelid()
API: RTSP::gst_rtsp_connection_do_tunnel()
API: RTSP::gst_rtsp_watch_reset()
Add support for tunneling RTSP over HTTP.
Fix documentation some more.
See also #573173.
API: RTSP:gst_rtsp_connection_is_tunneled()
API: RTSP:gst_rtsp_connection_set_tunneled()
Add transport define for RTSP tunneled over HTTP.
Parse rtsph:// uris as tunneled HTTP over TCP.
API: GstRTSPLowerTrans::GST_RTSP_LOWER_TRANS_HTTP
See also #573173.