const char *psz_url = luaL_checkstring( L, 2 );
const char *psz_user = luaL_nilorcheckstring( L, 3 );
const char *psz_password = luaL_nilorcheckstring( L, 4 );
- const vlc_acl_t *p_acl = lua_isnil( L, 5 ) ? NULL : luaL_checkudata( L, 5, "acl" );
+ const vlc_acl_t **pp_acl = lua_isnil( L, 5 ) ? NULL : luaL_checkudata( L, 5, "acl" );
/* Stack item 6 is the callback function */
luaL_argcheck( L, lua_isfunction( L, 6 ), 6, "Should be a function" );
/* Stack item 7 is the callback data */
lua_xmove( L, p_sys->L, 2 );
httpd_handler_t *p_handler = httpd_HandlerNew(
*pp_host, psz_url, psz_user, psz_password,
- p_acl, vlclua_httpd_handler_callback, p_sys );
+ pp_acl?*pp_acl:NULL,
+ vlclua_httpd_handler_callback, p_sys );
if( !p_handler )
{
free( p_sys );
const char *psz_mime = luaL_nilorcheckstring( L, 3 );
const char *psz_user = luaL_nilorcheckstring( L, 4 );
const char *psz_password = luaL_nilorcheckstring( L, 5 );
- const vlc_acl_t *p_acl = lua_isnil( L, 6 ) ? NULL : luaL_checkudata( L, 6, "acl" );
+ const vlc_acl_t **pp_acl = lua_isnil( L, 6 ) ? NULL : luaL_checkudata( L, 6, "acl" );
/* Stack item 7 is the callback function */
luaL_argcheck( L, lua_isfunction( L, 7 ), 7, "Should be a function" );
/* Stack item 8 is the callback data */
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, p_acl,
+ psz_user, psz_password,
+ pp_acl?*pp_acl:NULL,
vlclua_httpd_file_callback, p_sys );
if( !p_file )
{
local mime = mimes[ext]
-- print(url,mime)
if mime and string.match(mime,"^text/") then
- table.insert(files,file(h,dir.."/"..f,url,my_acl and my_acl.private,mime))
+ table.insert(files,file(h,dir.."/"..f,url,my_acl,mime))
else
- table.insert(files,rawfile(h,dir.."/"..f,url,my_acl and my_acl.private))
+ table.insert(files,rawfile(h,dir.."/"..f,url,my_acl))
end
elseif s.type == "dir" then
load_dir(dir.."/"..f,root..f.."/",my_acl)
end
if not has_index and not config.no_index then
-- print("Adding index for", root)
- table.insert(files,dirlisting(root,d,my_acl and my_acl.private))
+ table.insert(files,dirlisting(root,d,my_acl))
end
end
-local u = vlc.net.url_parse( config.host or "localhost:8080" )
+local u = vlc.net.url_parse( config.host or "0.0.0.0:8080" )
h = vlc.httpd(u.host,u.port)
load_dir( http_dir )