#include <vlc/vlc.h>
#include <vlc/input.h>
+#include "vlc_interaction.h"
#include "vlc_playlist.h"
#include "vlc_meta.h"
#include "network.h"
p_sys->psz_icy_title = NULL;
p_sys->i_remaining = 0;
+
/* Parse URI - remove spaces */
p = psz = strdup( p_access->psz_path );
while( (p = strchr( p, ' ' )) != NULL )
p_sys->b_reconnect = var_CreateGetBool( p_access, "http-reconnect" );
p_sys->b_continuous = var_CreateGetBool( p_access, "http-continuous" );
+connect:
/* Connect */
if( Connect( p_access, 0 ) )
{
}
}
+ if( p_sys->i_code == 401 )
+ {
+ char *psz_login = NULL; char *psz_password = NULL;
+ int i_ret;
+ msg_Dbg( p_access, "Authentication failed" );
+ i_ret = intf_UserLoginPassword( p_access, "HTTP authentication",
+ "Authentication failed", &psz_login, &psz_password );
+ if( i_ret == DIALOG_OK_YES )
+ {
+ msg_Dbg( p_access, "retrying with user=%s, pwd=%s",
+ psz_login, psz_password );
+ if( psz_login ) p_sys->url.psz_username = strdup( psz_login );
+ if( psz_password ) p_sys->url.psz_password = strdup( psz_password );
+ if( psz_login ) free( psz_login );
+ if( psz_password ) free( psz_password );
+ goto connect;
+ }
+ else
+ {
+ if( psz_login ) free( psz_login );
+ if( psz_password ) free( psz_password );
+ goto error;
+ }
+ }
+
if( ( p_sys->i_code == 301 || p_sys->i_code == 302 ||
p_sys->i_code == 303 || p_sys->i_code == 307 ) &&
p_sys->psz_location && *p_sys->psz_location )
{
p_sys->b_seekable = VLC_FALSE;
}
- if( p_sys->i_code >= 400 )
+ /* Authentication error - We'll have to display the dialog */
+ if( p_sys->i_code == 401 )
+ {
+
+ }
+ /* Other fatal error */
+ else if( p_sys->i_code >= 400 )
{
msg_Err( p_access, "error: %s", psz );
free( psz );