Commit 4acd6169 authored by Pierre Ynard's avatar Pierre Ynard

HTTP out: add glue code to set httpd configuration

The HTTP output parses the dst parameter to set the http-host and
http-port variables before calling the httpd, as discussed and approved
by Rémi in http://mailman.videolan.org/pipermail/vlc-devel/2011-September/081916.html
parent f7f350aa
...@@ -142,7 +142,6 @@ static int Open( vlc_object_t *p_this ) ...@@ -142,7 +142,6 @@ 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; const char *path = p_access->psz_path;
#if 1
/* Skip everything before / - backward compatibiltiy with VLC 1.1 */ /* Skip everything before / - backward compatibiltiy with VLC 1.1 */
path += strcspn( path, "/" ); path += strcspn( path, "/" );
if( path > p_access->psz_path ) if( path > p_access->psz_path )
...@@ -153,21 +152,37 @@ static int Open( vlc_object_t *p_this ) ...@@ -153,21 +152,37 @@ static int Open( vlc_object_t *p_this )
if( port != p_access->psz_path ) if( port != p_access->psz_path )
{ {
int len = (port ? port : path) - p_access->psz_path; int len = (port ? port : path) - p_access->psz_path;
msg_Err( p_access, "\"%.*s\" HTTP host ignored", len, /* msg_Err( p_access, "\"%.*s\" HTTP host ignored", len,
p_access->psz_path ); p_access->psz_path );
msg_Info( p_access, msg_Info( p_access,
"Pass --http-host=IP on the command line instead." ); "Pass --http-host=IP on the command line instead." ); */
char host[len + 1];
strncpy( host, p_access->psz_path, len );
host[len] = '\0';
var_Create( p_access, "http-host", VLC_VAR_STRING );
var_SetString( p_access, "http-host", host );
} }
if( port != NULL ) if( port != NULL )
{ {
int len = path - ++port; /* int len = path - ++port;
msg_Err( p_access, "\"%.*s\" HTTP port ignored", len, port ); msg_Err( p_access, "\"%.*s\" HTTP port ignored", len, port );
msg_Info( p_access, "Pass --%s-port=%.*s on the command line " msg_Info( p_access, "Pass --%s-port=%.*s on the command line "
"instead.", strcasecmp( p_access->psz_access, "https" ) "instead.", strcasecmp( p_access->psz_access, "https" )
? "http" : "https", len, port ); ? "http" : "https", len, port ); */
port++;
int bind_port = atoi( port );
if( bind_port > 0 )
{
const char *var = strcasecmp( p_access->psz_access, "https" )
? "http-port" : "https-port";
var_Create( p_access, var, VLC_VAR_INTEGER );
var_SetInteger( p_access, var, bind_port );
}
} }
} }
#endif
if( !*path ) if( !*path )
path = "/"; path = "/";
......
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