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

Phony error if old HTTP output syntax is used and avoid strdup()

parent 047f654a
...@@ -131,7 +131,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -131,7 +131,6 @@ static int Open( vlc_object_t *p_this )
sout_access_out_t *p_access = (sout_access_out_t*)p_this; sout_access_out_t *p_access = (sout_access_out_t*)p_this;
sout_access_out_sys_t *p_sys; sout_access_out_sys_t *p_sys;
char *psz_file_name;
char *psz_user; char *psz_user;
char *psz_pwd; char *psz_pwd;
char *psz_mime; char *psz_mime;
...@@ -142,12 +141,17 @@ static int Open( vlc_object_t *p_this ) ...@@ -142,12 +141,17 @@ static int Open( vlc_object_t *p_this )
config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
const char *path = p_access->psz_path;
/* Skip everything before / - backward compatibiltiy with VLC 1.1 */ /* Skip everything before / - backward compatibiltiy with VLC 1.1 */
const char *psz_parser = strchr( p_access->psz_path, '/' ); path += strcspn( path, "/" );
if( psz_parser ) if( path > p_access->psz_path )
psz_file_name = strdup( psz_parser ); {
else msg_Err( p_access, "\"%.*s\" HTTP host specification ignored",
psz_file_name = strdup( "/" ); path - p_access->psz_path, p_access->psz_path );
msg_Info( p_access, "(Use --http-host and/or --http-port instead.)" );
}
if( !*path )
path = "/";
/* TLS support */ /* TLS support */
if( p_access->psz_access && !strcmp( p_access->psz_access, "https" ) ) if( p_access->psz_access && !strcmp( p_access->psz_access, "https" ) )
...@@ -158,7 +162,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -158,7 +162,6 @@ static int Open( vlc_object_t *p_this )
if( p_sys->p_httpd_host == NULL ) if( p_sys->p_httpd_host == NULL )
{ {
msg_Err( p_access, "cannot start HTTP server" ); msg_Err( p_access, "cannot start HTTP server" );
free( psz_file_name );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -175,7 +178,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -175,7 +178,7 @@ static int Open( vlc_object_t *p_this )
} }
p_sys->p_httpd_stream = p_sys->p_httpd_stream =
httpd_StreamNew( p_sys->p_httpd_host, psz_file_name, psz_mime, httpd_StreamNew( p_sys->p_httpd_host, path, psz_mime,
psz_user, psz_pwd, NULL ); psz_user, psz_pwd, NULL );
free( psz_user ); free( psz_user );
free( psz_pwd ); free( psz_pwd );
...@@ -183,10 +186,9 @@ static int Open( vlc_object_t *p_this ) ...@@ -183,10 +186,9 @@ static int Open( vlc_object_t *p_this )
if( p_sys->p_httpd_stream == NULL ) if( p_sys->p_httpd_stream == NULL )
{ {
msg_Err( p_access, "cannot add stream %s", psz_file_name ); msg_Err( p_access, "cannot add stream %s", path );
httpd_HostDelete( p_sys->p_httpd_host ); httpd_HostDelete( p_sys->p_httpd_host );
free( psz_file_name );
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -203,8 +205,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -203,8 +205,7 @@ static int Open( vlc_object_t *p_this )
if( psz_name != NULL ) psz_name++; if( psz_name != NULL ) psz_name++;
else psz_name = psz_newuri; else psz_name = psz_newuri;
if( psz_file_name && if( asprintf( &psz_txt, "path=%s", path ) == -1 )
asprintf( &psz_txt, "path=%s", psz_file_name ) == -1 )
{ {
free( psz_uri ); free( psz_uri );
return VLC_ENOMEM; return VLC_ENOMEM;
...@@ -224,8 +225,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -224,8 +225,6 @@ static int Open( vlc_object_t *p_this )
p_sys->p_bonjour = NULL; p_sys->p_bonjour = NULL;
#endif #endif
free( psz_file_name );
p_sys->i_header_allocated = 1024; p_sys->i_header_allocated = 1024;
p_sys->i_header_size = 0; p_sys->i_header_size = 0;
p_sys->p_header = xmalloc( p_sys->i_header_allocated ); p_sys->p_header = xmalloc( p_sys->i_header_allocated );
......
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