diff options
author | Patricia Muscalu <patricia@axis.com> | 2013-11-12 10:55:14 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2013-11-12 12:21:50 +0100 |
commit | adc02db975d8bf615dda3e33efcb0feb490f5e83 (patch) | |
tree | 3acf7f5243859f503ec99eff6a93cb3a105314c9 /tests | |
parent | 8ce453d97d5a986f68cf34a57b0d663539634614 (diff) |
client: allow absolute path in requests
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=711689
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/gst/client.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/check/gst/client.c b/tests/check/gst/client.c index f30056d..da99aa8 100644 --- a/tests/check/gst/client.c +++ b/tests/check/gst/client.c @@ -155,6 +155,9 @@ GST_START_TEST (test_request) GstRTSPClient *client; GstRTSPMessage request = { 0, }; gchar *str; + GstRTSPConnection *conn; + GSocket *sock; + GError *error = NULL; client = gst_rtsp_client_new (); @@ -185,6 +188,41 @@ GST_START_TEST (test_request) gst_rtsp_message_unset (&request); + /* OPTIONS with an absolute path instead of an absolute url */ + /* set host information */ + sock = g_socket_new (G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_STREAM, + G_SOCKET_PROTOCOL_TCP, &error); + g_assert_no_error (error); + gst_rtsp_connection_create_from_socket (sock, "localhost", 444, NULL, &conn); + fail_unless (gst_rtsp_client_set_connection (client, conn)); + g_object_unref (sock); + + fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS, + "/test") == GST_RTSP_OK); + str = g_strdup_printf ("%d", cseq); + gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str); + g_free (str); + + gst_rtsp_client_set_send_func (client, test_response_200, NULL, NULL); + fail_unless (gst_rtsp_client_handle_message (client, + &request) == GST_RTSP_OK); + gst_rtsp_message_unset (&request); + + /* OPTIONS with an absolute path instead of an absolute url with invalid + * host information */ + g_object_unref (client); + client = gst_rtsp_client_new (); + fail_unless (gst_rtsp_message_init_request (&request, GST_RTSP_OPTIONS, + "/test") == GST_RTSP_OK); + str = g_strdup_printf ("%d", cseq); + gst_rtsp_message_add_header (&request, GST_RTSP_HDR_CSEQ, str); + g_free (str); + + gst_rtsp_client_set_send_func (client, test_response_400, NULL, NULL); + fail_unless (gst_rtsp_client_handle_message (client, + &request) == GST_RTSP_OK); + gst_rtsp_message_unset (&request); + g_object_unref (client); } |