Commit 6a7c3718 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Lua: remove httpd ACL support

parent 7bf9e92c
......@@ -149,11 +149,10 @@ 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 **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_settop( L, 7 );
/* Stack item 5 is the callback function */
luaL_argcheck( L, lua_isfunction( L, 5 ), 5, "Should be a function" );
/* Stack item 6 is the callback data */
lua_settop( L, 6 );
httpd_handler_sys_t *p_sys = (httpd_handler_sys_t*)
malloc( sizeof( httpd_handler_sys_t ) );
if( !p_sys )
......@@ -164,8 +163,7 @@ static int vlclua_httpd_handler_new( lua_State * L )
* 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,
pp_acl?*pp_acl:NULL,
*pp_host, psz_url, psz_user, psz_password, NULL,
vlclua_httpd_handler_callback, p_sys );
if( !p_handler )
{
......@@ -242,9 +240,8 @@ 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 **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" );
luaL_argcheck( L, lua_isfunction( L, 6 ), 6, "Should be a function" );
/* Stack item 8 is the callback data */
httpd_file_sys_t *p_sys = (httpd_file_sys_t *)
malloc( sizeof( httpd_file_sys_t ) );
......@@ -254,8 +251,7 @@ 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,
pp_acl?*pp_acl:NULL,
psz_user, psz_password, NULL,
vlclua_httpd_file_callback, p_sys );
if( !p_file )
{
......
......@@ -106,8 +106,8 @@ HTTPd
http( host, port, [cert, key, ca, crl]): create a new HTTP (SSL) daemon.
local h = vlc.httpd( "localhost", 8080 )
h:handler( url, user, password, acl, callback, data ) -- add a handler for given url. If user and password are non nil, they will be used to authenticate connecting clients. If acl is non nil, it will be used to restrict access. callback will be called to handle connections. The callback function takes 7 arguments: data, url, request, type, in, addr, host. It returns the reply as a string.
h:file( url, mime, user, password, acl, callback, data ) -- add a file for given url with given mime type. If user and password are non nil, they will be used to authenticate connecting clients. If acl is non nil, it will be used to restrict access. callback will be called to handle connections. The callback function takes 2 arguments: data and request. It returns the reply as a string.
h:handler( url, user, password, callback, data ) -- add a handler for given url. If user and password are non nil, they will be used to authenticate connecting clients. callback will be called to handle connections. The callback function takes 7 arguments: data, url, request, type, in, addr, host. It returns the reply as a string.
h:file( url, mime, user, password, callback, data ) -- add a file for given url with given mime type. If user and password are non nil, they will be used to authenticate connecting clients. callback will be called to handle connections. The callback function takes 2 arguments: data and request. It returns the reply as a string.
h:redirect( url_dst, url_src ): Redirect all connections from url_src to url_dst.
Input
......
......@@ -134,7 +134,7 @@ function dirlisting(url,listing)
</body>
</html>]]
end
return h:file(url,"text/html",nil,password,nil,callback,nil)
return h:file(url,"text/html",nil,password,callback,nil)
end
-- FIXME: Experimental art support. Needs some cleaning up.
......@@ -207,7 +207,7 @@ function file(h,path,url,mime)
end
return table.concat(page)
end
return h:file(url or path,mime,nil,password,nil,callback,nil)
return h:file(url or path,mime,nil,password,callback,nil)
end
function rawfile(h,path,url)
......@@ -228,7 +228,7 @@ function rawfile(h,path,url)
end
return page
end
return h:file(url or path,nil,nil,password,nil,callback,nil)
return h:file(url or path,nil,nil,password,callback,nil)
end
function parse_url_request(request)
......@@ -320,4 +320,4 @@ end
password = vlc.var.inherit(nil,"http-password")
h = vlc.httpd()
local a = h:handler("/art",nil,password,nil,callback_art,nil)
local a = h:handler("/art",nil,password,callback_art,nil)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment