diff options
-rw-r--r-- | gst-libs/gst/rtsp/gstrtspconnection.c | 43 | ||||
-rw-r--r-- | gst-libs/gst/rtsp/gstrtspconnection.h | 6 |
2 files changed, 48 insertions, 1 deletions
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c index b2d3f8ab5..64eb4b89a 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.c +++ b/gst-libs/gst/rtsp/gstrtspconnection.c @@ -173,6 +173,7 @@ struct _GstRTSPConnection gchar tunnelid[TUNNELID_LEN]; gboolean tunneled; + gboolean ignore_x_server_reply; GstRTSPTunnelState tstate; /* the remote and local ip */ @@ -878,7 +879,8 @@ setup_tunneling (GstRTSPConnection * conn, gint64 timeout, gchar * uri, response->type_data.response.code != GST_RTSP_STS_OK) goto wrong_result; - if (gst_rtsp_message_get_header (response, GST_RTSP_HDR_X_SERVER_IP_ADDRESS, + if (!conn->ignore_x_server_reply && + gst_rtsp_message_get_header (response, GST_RTSP_HDR_X_SERVER_IP_ADDRESS, &value, 0) == GST_RTSP_OK) { g_free (url->host); url->host = g_strdup (value); @@ -3464,6 +3466,45 @@ gst_rtsp_connection_get_tunnelid (const GstRTSPConnection * conn) } /** + * gst_rtsp_connection_set_ignore_x_server_reply: + * @conn: a #GstRTSPConnection + * @ignore: %TRUE to ignore the x-server-ip-address header reply or %FALSE to + * comply with it (%FALSE is the default). + * + * Set whether to ignore the x-server-ip-address header reply or not. If the + * header is ignored, the original address will be used instead. + * + * Since: 1.20 + */ +void +gst_rtsp_connection_set_ignore_x_server_reply (GstRTSPConnection * conn, + gboolean ignore) +{ + g_return_if_fail (conn != NULL); + + conn->ignore_x_server_reply = ignore; +} + +/** + * gst_rtsp_connection_get_ignore_x_server_reply: + * @conn: a #GstRTSPConnection + * + * Get the ignore_x_server_reply value. + * + * Returns: returns %TRUE if the x-server-ip-address header reply will be + * ignored, else returns %FALSE + * + * Since: 1.20 + */ +gboolean +gst_rtsp_connection_get_ignore_x_server_reply (const GstRTSPConnection * conn) +{ + g_return_val_if_fail (conn != NULL, FALSE); + + return conn->ignore_x_server_reply; +} + +/** * gst_rtsp_connection_do_tunnel: * @conn: a #GstRTSPConnection * @conn2: a #GstRTSPConnection or %NULL diff --git a/gst-libs/gst/rtsp/gstrtspconnection.h b/gst-libs/gst/rtsp/gstrtspconnection.h index 21eee0da2..2eeb462bd 100644 --- a/gst-libs/gst/rtsp/gstrtspconnection.h +++ b/gst-libs/gst/rtsp/gstrtspconnection.h @@ -235,6 +235,12 @@ void gst_rtsp_connection_set_remember_session_id (GstRTSPConnectio GST_RTSP_API gboolean gst_rtsp_connection_get_remember_session_id (GstRTSPConnection *conn); +GST_RTSP_API +void gst_rtsp_connection_set_ignore_x_server_reply (GstRTSPConnection *conn, gboolean ignore); + +GST_RTSP_API +gboolean gst_rtsp_connection_get_ignore_x_server_reply (const GstRTSPConnection *conn); + /* async IO */ /** |