]> git.sesse.net Git - vlc/commitdiff
Lua: remove httpd ACL support
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 1 Apr 2012 19:57:24 +0000 (22:57 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 1 Apr 2012 20:08:16 +0000 (23:08 +0300)
modules/lua/libs/httpd.c
share/lua/README.txt
share/lua/intf/http.lua

index 85a38cc7c1192cfef057641fe7d3aed8b37d38bb..7a975d4bb6d4df997bd315de0c7d3380dd83669a 100644 (file)
@@ -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 )
     {
index 5609c176b2aab284e5108ce944335d1f7a3fe0d9..4344e55eb2ccf8b703ef59e642a63352a561b633 100644 (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
index dc7d5d369749d25286cc0c81e9c12246d6e5ba36..8e44c61baee97c5d09ba6e5b0cae28105191c333 100644 (file)
@@ -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)