[vlc-devel] commit: Fix acl use in http interface. Change default host to 0.0.0.0:8080. The default .hosts file still limits access to default host. ( Antoine Cellerier )
git version control
git at videolan.org
Mon Dec 14 23:29:56 CET 2009
vlc | branch: master | Antoine Cellerier <antoine at macbook.(none)> | Mon Dec 14 22:28:12 2009 +0100| [9bb85a1772757195bd658b3d28ce1920d1d4b846] | committer: Antoine Cellerier
Fix acl use in http interface. Change default host to 0.0.0.0:8080. The default .hosts file still limits access to default host.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9bb85a1772757195bd658b3d28ce1920d1d4b846
---
modules/misc/lua/libs/httpd.c | 10 ++++++----
share/lua/intf/http.lua | 8 ++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/modules/misc/lua/libs/httpd.c b/modules/misc/lua/libs/httpd.c
index 09ca8a4..1dcb125 100644
--- a/modules/misc/lua/libs/httpd.c
+++ b/modules/misc/lua/libs/httpd.c
@@ -164,7 +164,7 @@ static int vlclua_httpd_handler_new( lua_State * L )
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 */
@@ -180,7 +180,8 @@ static int vlclua_httpd_handler_new( lua_State * L )
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 );
@@ -256,7 +257,7 @@ static int vlclua_httpd_file_new( lua_State *L )
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 */
@@ -268,7 +269,8 @@ static int vlclua_httpd_file_new( lua_State *L )
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 )
{
diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index dbf4caa..484ec6a 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -258,9 +258,9 @@ local function load_dir(dir,root,parent_acl)
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)
@@ -269,11 +269,11 @@ local function load_dir(dir,root,parent_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 )
More information about the vlc-devel
mailing list