Commit a1aaf849 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Encode URL if needed (should fix Debian bug #279735)

parent 74a5f722
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/input.h> #include <vlc/input.h>
#include "network.h"
#include <iostream> #include <iostream>
...@@ -132,6 +133,7 @@ typedef struct ...@@ -132,6 +133,7 @@ typedef struct
struct demux_sys_t struct demux_sys_t
{ {
char *p_sdp; /* XXX mallocated */ char *p_sdp; /* XXX mallocated */
char *psz_path; /* URL-encoded path */
MediaSession *ms; MediaSession *ms;
TaskScheduler *scheduler; TaskScheduler *scheduler;
...@@ -226,6 +228,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -226,6 +228,7 @@ static int Open ( vlc_object_t *p_this )
p_sys->b_no_data = VLC_TRUE; p_sys->b_no_data = VLC_TRUE;
p_sys->i_no_data_ti = 0; p_sys->i_no_data_ti = 0;
p_sys->b_multicast = VLC_FALSE; p_sys->b_multicast = VLC_FALSE;
p_sys->psz_path = p_demux->psz_path;
if( ( p_sys->scheduler = BasicTaskScheduler::createNew() ) == NULL ) if( ( p_sys->scheduler = BasicTaskScheduler::createNew() ) == NULL )
...@@ -239,6 +242,13 @@ static int Open ( vlc_object_t *p_this ) ...@@ -239,6 +242,13 @@ static int Open ( vlc_object_t *p_this )
goto error; goto error;
} }
if( vlc_UrlIsNotEncoded( p_sys->psz_path ) )
{
p_sys->psz_path = vlc_UrlEncode( p_sys->psz_path );
if( p_sys->psz_path == NULL )
goto error;
}
if( p_demux->s == NULL && !strcasecmp( p_demux->psz_access, "rtsp" ) ) if( p_demux->s == NULL && !strcasecmp( p_demux->psz_access, "rtsp" ) )
{ {
char *psz_url; char *psz_url;
...@@ -251,8 +261,8 @@ static int Open ( vlc_object_t *p_this ) ...@@ -251,8 +261,8 @@ static int Open ( vlc_object_t *p_this )
p_sys->env->getResultMsg() ); p_sys->env->getResultMsg() );
goto error; goto error;
} }
psz_url = (char*)malloc( strlen( p_demux->psz_path ) + 8 ); psz_url = (char*)malloc( strlen( p_sys->psz_path ) + 8 );
sprintf( psz_url, "rtsp://%s", p_demux->psz_path ); sprintf( psz_url, "rtsp://%s", p_sys->psz_path );
psz_options = p_sys->rtsp->sendOptionsCmd( psz_url ); psz_options = p_sys->rtsp->sendOptionsCmd( psz_url );
if( psz_options ) if( psz_options )
...@@ -276,7 +286,7 @@ static int Open ( vlc_object_t *p_this ) ...@@ -276,7 +286,7 @@ static int Open ( vlc_object_t *p_this )
} }
else if( p_demux->s == NULL && !strcasecmp( p_demux->psz_access, "sdp" ) ) else if( p_demux->s == NULL && !strcasecmp( p_demux->psz_access, "sdp" ) )
{ {
p_sys->p_sdp = strdup( p_demux->psz_path ); p_sys->p_sdp = strdup( p_sys->psz_path );
} }
else else
{ {
...@@ -626,6 +636,10 @@ error: ...@@ -626,6 +636,10 @@ error:
{ {
free( p_sys->p_sdp ); free( p_sys->p_sdp );
} }
if( ( p_sys->psz_path != NULL )
&& ( p_sys->psz_path != p_demux->psz_path ) )
free( p_sys->psz_path );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -663,6 +677,8 @@ static void Close( vlc_object_t *p_this ) ...@@ -663,6 +677,8 @@ static void Close( vlc_object_t *p_this )
if( p_sys->env ) RECLAIM_ENV(p_sys->env); if( p_sys->env ) RECLAIM_ENV(p_sys->env);
if( p_sys->scheduler ) delete p_sys->scheduler; if( p_sys->scheduler ) delete p_sys->scheduler;
if( p_sys->p_sdp ) free( p_sys->p_sdp ); if( p_sys->p_sdp ) free( p_sys->p_sdp );
if( p_sys->psz_path != p_demux->psz_path )
free( p_sys->psz_path );
free( p_sys ); free( p_sys );
} }
...@@ -955,7 +971,7 @@ static int RollOverTcp( demux_t *p_demux ) ...@@ -955,7 +971,7 @@ static int RollOverTcp( demux_t *p_demux )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
asprintf( &psz_url, "rtsp://%s", p_demux->psz_path ); asprintf( &psz_url, "rtsp://%s", p_sys->psz_path );
if( ( psz_options = p_sys->rtsp->sendOptionsCmd( psz_url ) ) ) if( ( psz_options = p_sys->rtsp->sendOptionsCmd( psz_url ) ) )
delete [] psz_options; delete [] psz_options;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment