char *psz_parser = psz_dup;
/* Parse server:port */
- while( *psz_parser && *psz_parser != ':' )
+ if( *psz_parser == '[' )
{
- if( *psz_parser == '[' )
- {
- /* IPV6 */
- while( *psz_parser && *psz_parser != ']' )
- {
- psz_parser++;
- }
- }
- psz_parser++;
+ psz_parser = strchr( psz_parser, ']' );
+ if( psz_parser == NULL )
+ psz_parser = psz_dup;
}
- if( *psz_parser != ':' || psz_parser == psz_dup )
+ psz_parser = strchr( psz_parser, ':' );
+
+ if( psz_parser == NULL )
{
- msg_Err( p_access, "you have to provide server:port addresse" );
+ msg_Err( p_access, "missing port number : %s", psz_dup );
free( psz_dup );
return VLC_EGENERIC;
}
- *psz_parser++ = '\0';
- if( atoi( psz_parser ) <= 0 )
- {
- msg_Err( p_access, "invalid port number (%d)", atoi( psz_parser ) );
- free( psz_dup );
- return VLC_EGENERIC;
- }
+ *psz_parser++ = '\0';
/* Init p_access */
p_access->pf_read = Read;