[vlc-commits] Lua: remove httpd ACL support

Rémi Denis-Courmont git at videolan.org
Sun Apr 1 22:18:10 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr  1 22:57:24 2012 +0300| [6a7c37184b40904b2727fed1a0022b036d1a3757] | committer: Rémi Denis-Courmont

Lua: remove httpd ACL support

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a7c37184b40904b2727fed1a0022b036d1a3757
---

 modules/lua/libs/httpd.c |   18 +++++++-----------
 share/lua/README.txt     |    4 ++--
 share/lua/intf/http.lua  |    8 ++++----
 3 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/modules/lua/libs/httpd.c b/modules/lua/libs/httpd.c
index 85a38cc..7a975d4 100644
--- a/modules/lua/libs/httpd.c
+++ b/modules/lua/libs/httpd.c
@@ -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 )
     {
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 5609c17..4344e55 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -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
diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua
index dc7d5d3..8e44c61 100644
--- a/share/lua/intf/http.lua
+++ b/share/lua/intf/http.lua
@@ -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)



More information about the vlc-commits mailing list