/*****************************************************************************
* http.c: HTTP input module
*****************************************************************************
- * Copyright (C) 2001-2005 the VideoLAN team
+ * Copyright (C) 2001-2008 the VideoLAN team
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
* Christophe Massiot <massiot@via.ecp.fr>
* RĂ©mi Denis-Courmont <rem # videolan.org>
+ * Antoine Cellerier <dionoea at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#endif
#include <vlc/vlc.h>
+#include <vlc_plugin.h>
#include <vlc_access.h>
# include <zlib.h>
#endif
+#include <assert.h>
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define FORWARD_COOKIES_LONGTEXT N_("Forward Cookies Across http redirections ")
vlc_module_begin();
- set_description( _("HTTP input") );
- set_capability( "access2", 0 );
- set_shortname( _( "HTTP(S)" ) );
+ set_description( N_("HTTP input") );
+ set_capability( "access", 0 );
+ set_shortname( N_( "HTTP(S)" ) );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_ACCESS );
* Local prototypes
*****************************************************************************/
-/* RFC 2617: Basic and Digest Access Authentification */
+/* RFC 2617: Basic and Digest Access Authentication */
typedef struct http_auth_t
{
char *psz_realm;
{
if( !strcasecmp( p_sys->psz_mime, "video/nsv" ) ||
!strcasecmp( p_sys->psz_mime, "video/nsa" ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "nsv" );
+ }
else if( !strcasecmp( p_sys->psz_mime, "audio/aac" ) ||
!strcasecmp( p_sys->psz_mime, "audio/aacp" ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "m4a" );
+ }
else if( !strcasecmp( p_sys->psz_mime, "audio/mpeg" ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "mp3" );
+ }
msg_Info( p_access, "Raw-audio server found, %s demuxer selected",
p_access->psz_demux );
}
else if( !p_sys->psz_mime )
{
- /* Shoutcast */
- p_access->psz_demux = strdup( "mp3" );
+ free( p_access->psz_demux );
+ /* Shoutcast */
+ p_access->psz_demux = strdup( "mp3" );
}
/* else probably Ogg Vorbis */
}
p_sys->psz_mime &&
!strcasecmp( p_sys->psz_mime, "misc/ultravox" ) )
{
+ free( p_access->psz_demux );
/* Grrrr! detect ultravox server and force NSV demuxer */
p_access->psz_demux = strdup( "nsv" );
}
else if( !strcmp( p_access->psz_access, "itpc" ) )
{
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "podcast" );
}
else if( p_sys->psz_mime &&
!strncasecmp( p_sys->psz_mime, "application/xspf+xml", 20 ) &&
( memchr( " ;\t", p_sys->psz_mime[20], 4 ) != NULL ) )
+ {
+ free( p_access->psz_demux );
p_access->psz_demux = strdup( "xspf-open" );
+ }
if( p_sys->b_reconnect ) msg_Dbg( p_access, "auto re-connect enabled" );
*****************************************************************************/
static int Seek( access_t *p_access, int64_t i_pos )
{
- msg_Dbg( p_access, "trying to seek to "I64Fd, i_pos );
+ msg_Dbg( p_access, "trying to seek to %"PRId64, i_pos );
Disconnect( p_access );
if( p_sys->i_version == 1 )
{
net_Printf( VLC_OBJECT(p_access), p_sys->fd, pvs,
- "Range: bytes="I64Fd"-\r\n", i_tell );
+ "Range: bytes=%"PRId64"-\r\n", i_tell );
}
/* Cookies */
else
{
p_access->info.i_size = i_tell + atoll( p );
- msg_Dbg( p_access, "stream size="I64Fd, p_access->info.i_size );
+ msg_Dbg( p_access, "stream size=%"PRId64, p_access->info.i_size );
}
}
else if( !strcasecmp( psz, "Location" ) )
}
/*****************************************************************************
- * "RFC 2617: Basic and Digest Access Authentification" header parsing
+ * "RFC 2617: Basic and Digest Access Authentication" header parsing
*****************************************************************************/
static char *AuthGetParam( const char *psz_header, const char *psz_param )
{