+ const char *path = p_access->psz_path;
+ path += strcspn( path, "/" );
+ if( path > p_access->psz_path )
+ {
+ const char *port = strrchr( p_access->psz_path, ':' );
+ if( port != NULL && strchr( port, ']' ) != NULL )
+ port = NULL; /* IPv6 numeral */
+ if( port != p_access->psz_path )
+ {
+ int len = (port ? port : path) - p_access->psz_path;
+ msg_Warn( p_access, "\"%.*s\" HTTP host might be ignored in "
+ "multiple-host configurations, use at your own risks.",
+ len, p_access->psz_path );
+ msg_Info( p_access, "Consider passing --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 )
+ {
+ /* int len = path - ++port;
+ msg_Info( p_access, "Consider passing --%s-port=%.*s on the "
+ "command line instead.",
+ strcasecmp( p_access->psz_access, "https" )
+ ? "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 );
+ }
+ }
+ }
+ if( !*path )
+ path = "/";