client: don't crash when tunnelid is missing

When a clients tries to open an HTTP tunnel but fails to provide a tunnelid,
don't crash but return an error response to the client.

Fixes #589489
This commit is contained in:
Wim Taymans 2009-07-24 12:49:41 +02:00
parent 748290b888
commit daccf6bc99

View file

@ -1359,6 +1359,8 @@ tunnel_start (GstRTSPWatch * watch, gpointer user_data)
/* store client in the pending tunnels */
tunnelid = gst_rtsp_connection_get_tunnelid (client->connection);
if (tunnelid == NULL)
goto no_tunnelid;
g_message ("client %p: inserting %s", client, tunnelid);
@ -1373,6 +1375,11 @@ tunnel_start (GstRTSPWatch * watch, gpointer user_data)
return GST_RTSP_STS_OK;
/* ERRORS */
no_tunnelid:
{
g_message ("client %p: no tunnelid provided", client);
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
tunnel_existed:
{
g_mutex_unlock (tunnels_lock);
@ -1392,6 +1399,8 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
/* find previous tunnel */
tunnelid = gst_rtsp_connection_get_tunnelid (client->connection);
if (tunnelid == NULL)
goto no_tunnelid;
g_mutex_lock (tunnels_lock);
if (!(oclient = g_hash_table_lookup (tunnels, tunnelid)))
@ -1417,11 +1426,16 @@ tunnel_complete (GstRTSPWatch * watch, gpointer user_data)
return GST_RTSP_OK;
/* ERRORS */
no_tunnelid:
{
g_message ("client %p: no tunnelid provided", client);
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
no_tunnel:
{
g_mutex_unlock (tunnels_lock);
g_message ("client %p: tunnel session %s not found", client, tunnelid);
return GST_RTSP_OK;
return GST_RTSP_STS_SERVICE_UNAVAILABLE;
}
}