+/* Returns TRUE if there are no Require headers, otherwise returns FALSE
+ * and also returns a newly-allocated string of (comma-separated) unsupported
+ * options in the unsupported_reqs variable .
+ *
+ * There may be multiple Require headers, but we must send one single
+ * Unsupported header with all the unsupported options as response. If
+ * an incoming Require header contained a comma-separated list of options
+ * GstRtspConnection will already have split that list up into multiple
+ * headers.
+ *
+ * TODO: allow the application to decide what features are supported
+ */
+static gboolean
+check_request_requirements (GstRTSPMessage * msg, gchar ** unsupported_reqs)
+{
+ GstRTSPResult res;
+ GPtrArray *arr = NULL;
+ gchar *reqs = NULL;
+ gint i;
+
+ i = 0;
+ do {
+ res = gst_rtsp_message_get_header (msg, GST_RTSP_HDR_REQUIRE, &reqs, i++);
+
+ if (res == GST_RTSP_ENOTIMPL)
+ break;
+
+ if (arr == NULL)
+ arr = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);
+
+ g_ptr_array_add (arr, g_strdup (reqs));
+ }
+ while (TRUE);
+
+ /* if we don't have any Require headers at all, all is fine */
+ if (i == 1)
+ return TRUE;
+
+ /* otherwise we've now processed at all the Require headers */
+ g_ptr_array_add (arr, NULL);
+
+ /* for now we don't commit to supporting anything, so will just report
+ * all of the required options as unsupported */
+ *unsupported_reqs = g_strjoinv (", ", (gchar **) arr->pdata);
+
+ g_ptr_array_unref (arr);
+ return FALSE;
+}
+