/* High level */
-VLC_API httpd_file_t * httpd_FileNew( httpd_host_t *, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl, httpd_file_callback_t pf_fill, httpd_file_sys_t * ) VLC_USED;
+VLC_API httpd_file_t * httpd_FileNew( httpd_host_t *, const char *psz_url, const char *psz_mime, const char *psz_user, const char *psz_password, httpd_file_callback_t pf_fill, httpd_file_sys_t * ) VLC_USED;
VLC_API httpd_file_sys_t * httpd_FileDelete( httpd_file_t * );
-VLC_API httpd_handler_t * httpd_HandlerNew( httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl, httpd_handler_callback_t pf_fill, httpd_handler_sys_t * ) VLC_USED;
+VLC_API httpd_handler_t * httpd_HandlerNew( httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, httpd_handler_callback_t pf_fill, httpd_handler_sys_t * ) VLC_USED;
VLC_API httpd_handler_sys_t * httpd_HandlerDelete( httpd_handler_t * );
* the callback's stack. */
lua_xmove( L, p_sys->L, 2 );
httpd_handler_t *p_handler = httpd_HandlerNew(
- *pp_host, psz_url, psz_user, psz_password, NULL,
+ *pp_host, psz_url, psz_user, psz_password,
vlclua_httpd_handler_callback, p_sys );
if( !p_handler )
{
p_sys->ref = luaL_ref( L, LUA_REGISTRYINDEX ); /* pops the object too */
lua_xmove( L, p_sys->L, 2 );
httpd_file_t *p_file = httpd_FileNew( *pp_host, psz_url, psz_mime,
- psz_user, psz_password, NULL,
+ psz_user, psz_password,
vlclua_httpd_file_callback, p_sys );
if( !p_file )
{
httpd_file_t *httpd_FileNew (httpd_host_t *host,
const char *url, const char *content_type,
const char *login, const char *password,
- const vlc_acl_t *acl,
httpd_file_callback_t cb, httpd_file_sys_t *data)
{
(void) host;
(void) url; (void) content_type;
- (void) login; (void) password; (void) acl;
+ (void) login; (void) password;
(void) cb; (void) data;
assert (0);
}
httpd_handler_t *httpd_HandlerNew (httpd_host_t *host, const char *url,
const char *login, const char *password,
- const vlc_acl_t *acl,
httpd_handler_callback_t cb,
httpd_handler_sys_t *data)
{
(void) host; (void) url;
- (void) login; (void) password; (void) acl;
+ (void) login; (void) password;
(void) cb; (void) data;
assert (0);
}
#include <vlc_network.h>
#include <vlc_tls.h>
-#include <vlc_acl.h>
#include <vlc_strings.h>
#include <vlc_rand.h>
#include <vlc_charset.h>
#endif
static void httpd_ClientClean( httpd_client_t *cl );
-static httpd_url_t *httpd_UrlNewPrivate( httpd_host_t *, const char *,
- const char *, const char *,
- const vlc_acl_t * );
/* each host run in his own thread */
struct httpd_host_t
char *psz_url;
char *psz_user;
char *psz_password;
- vlc_acl_t *p_acl;
struct
{
httpd_file_t *httpd_FileNew( httpd_host_t *host,
const char *psz_url, const char *psz_mime,
const char *psz_user, const char *psz_password,
- const vlc_acl_t *p_acl, httpd_file_callback_t pf_fill,
+ httpd_file_callback_t pf_fill,
httpd_file_sys_t *p_sys )
{
httpd_file_t *file = xmalloc( sizeof( httpd_file_t ) );
- file->url = httpd_UrlNewPrivate( host, psz_url, psz_user, psz_password,
- p_acl );
+ file->url = httpd_UrlNew( host, psz_url, psz_user, psz_password );
if( file->url == NULL )
{
free( file );
httpd_handler_t *httpd_HandlerNew( httpd_host_t *host, const char *psz_url,
const char *psz_user,
const char *psz_password,
- const vlc_acl_t *p_acl,
httpd_handler_callback_t pf_fill,
httpd_handler_sys_t *p_sys )
{
httpd_handler_t *handler = xmalloc( sizeof( httpd_handler_t ) );
- handler->url = httpd_UrlNewPrivate( host, psz_url, psz_user, psz_password,
- p_acl );
+ handler->url = httpd_UrlNew( host, psz_url, psz_user, psz_password );
if( handler->url == NULL )
{
free( handler );
{
httpd_stream_t *stream = xmalloc( sizeof( httpd_stream_t ) );
- stream->url = httpd_UrlNewPrivate( host, psz_url, psz_user, psz_password,
- NULL );
+ stream->url = httpd_UrlNew( host, psz_url, psz_user, psz_password );
if( stream->url == NULL )
{
free( stream );
}
/* register a new url */
-static httpd_url_t *httpd_UrlNewPrivate( httpd_host_t *host, const char *psz_url,
- const char *psz_user, const char *psz_password,
- const vlc_acl_t *p_acl )
+httpd_url_t *httpd_UrlNew( httpd_host_t *host, const char *psz_url,
+ const char *psz_user, const char *psz_password )
{
httpd_url_t *url;
url->psz_url = strdup( psz_url );
url->psz_user = strdup( psz_user ? psz_user : "" );
url->psz_password = strdup( psz_password ? psz_password : "" );
- url->p_acl = ACL_Duplicate( host, p_acl );
for( int i = 0; i < HTTPD_MSG_MAX; i++ )
{
url->catch[i].cb = NULL;
return url;
}
-httpd_url_t *httpd_UrlNew( httpd_host_t *host, const char *psz_url,
- const char *psz_user, const char *psz_password )
-{
- return httpd_UrlNewPrivate( host, psz_url, psz_user, psz_password, NULL );
-}
-
/* register callback on a url */
int httpd_UrlCatch( httpd_url_t *url, int i_msg, httpd_callback_t cb,
httpd_callback_sys_t *p_sys )
free( url->psz_url );
free( url->psz_user );
free( url->psz_password );
- ACL_Destroy( url->p_acl );
for( i = 0; i < host->i_client; i++ )
{
else
{
bool b_auth_failed = false;
- bool b_hosts_failed = false;
/* Search the url and trigger callbacks */
for(int i = 0; i < host->i_url; i++ )
{
if( url->catch[i_msg].cb )
{
- if( answer && ( url->p_acl != NULL ) )
- {
- char ip[NI_MAXNUMERICHOST];
-
- if( ( httpd_ClientIP( cl, ip, NULL ) == NULL )
- || ACL_Check( url->p_acl, ip ) )
- {
- b_hosts_failed = true;
- break;
- }
- }
-
if( answer && ( *url->psz_user || *url->psz_password ) )
{
/* create the headers */
answer->i_type = HTTPD_MSG_ANSWER;
answer->i_version= 0;
- if( b_hosts_failed )
- {
- answer->i_status = 403;
- }
- else if( b_auth_failed )
+ if( b_auth_failed )
{
answer->i_status = 401;
}