diff options
| author | ame <[email protected]> | 2024-02-02 08:37:52 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2024-02-02 08:37:52 -0600 |
| commit | 3218ddb8953b3ab71a4f371b2f3b599f53816255 (patch) | |
| tree | 5c1950e611843ee5ae1a4e33734766c8b233ddfb /src/net.c | |
| parent | 18a0280167c93985c15eed838a0319448530bee0 (diff) | |
wildcard
Diffstat (limited to 'src/net.c')
| -rw-r--r-- | src/net.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -294,7 +294,7 @@ void* handle_client(void *_arg){ str* aa = str_init(portc);
str_push(aa, table[k]->c);
- void* v = parray_get(paths, aa->c);
+ void* v = parray_find(paths, aa->c);
if(v == NULL){
str* resp;
@@ -339,9 +339,31 @@ void* handle_client(void *_arg){ lua_settable(L, res_idx);
//the function(s)
- struct sarray_t* awa = (struct sarray_t*)v;
+ //get all function that kinda match
+ parray_t* owo = (parray_t*)v;
+ for(int i = 0; i != owo->len; i++){
+ //though these are arrays of arrays we have to iterate *again*
+ struct sarray_t* awa = (struct sarray_t*)owo->P[i].value;
+
+ for(int z = 0; z != awa->len; z++){
+ struct lchar* wowa = awa->cs[z];
+
+ luaL_loadbuffer(L, wowa->c, wowa->len, wowa->c);
+
+ int func = lua_gettop(L);
+
+ lua_pushvalue(L, func); // push function call
+ lua_pushvalue(L, res_idx); //push methods related to dealing with the request
+ lua_pushvalue(L, req_idx); //push info about the request
+
+ //call the function
+ lua_call(L, 2, 0);
+ }
+ }
+ /*
for(int i = 0; i != awa->len; i++){
- struct lchar* wowa = awa->cs[i];
+ //struct lchar* wowa = awa->cs[i];
+
luaL_loadbuffer(L, wowa->c, wowa->len, wowa->c);
int func = lua_gettop(L);
@@ -352,7 +374,8 @@ void* handle_client(void *_arg){ //call the function
lua_call(L, 2, 0);
- }
+ }*/
+
}
}
|
