relay: do forward data if the http request type was HEAD
[project/uhttpd.git] / lua.c
diff --git a/lua.c b/lua.c
index 6bf5c24..aa27ec0 100644 (file)
--- a/lua.c
+++ b/lua.c
@@ -144,7 +144,7 @@ static lua_State *uh_lua_state_init(void)
        lua_State *L;
        int ret;
 
        lua_State *L;
        int ret;
 
-       L = lua_open();
+       L = luaL_newstate();
        luaL_openlibs(L);
 
        /* build uhttpd api table */
        luaL_openlibs(L);
 
        /* build uhttpd api table */
@@ -218,7 +218,8 @@ static void lua_main(struct client *cl, struct path_info *pi, char *url)
        path_len = strlen(url);
        str = strchr(url, '?');
        if (str) {
        path_len = strlen(url);
        str = strchr(url, '?');
        if (str) {
-               pi->query = str;
+               if (*(str + 1))
+                       pi->query = str + 1;
                path_len = str - url;
        }
        if (path_len > prefix_len) {
                path_len = str - url;
        }
        if (path_len > prefix_len) {
@@ -280,6 +281,7 @@ static bool check_lua_url(const char *url)
 }
 
 static struct dispatch_handler lua_dispatch = {
 }
 
 static struct dispatch_handler lua_dispatch = {
+       .script = true,
        .check_url = check_lua_url,
        .handle_request = lua_handle_request,
 };
        .check_url = check_lua_url,
        .handle_request = lua_handle_request,
 };