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 )
* 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 )
{
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 ) );
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 )
{
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
</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.
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)
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)
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)