diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-20 13:45:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-03-20 13:45:50 +0000 |
commit | 0f18174879e121e5c5a64de0e3cb88a9c78e2b37 (patch) | |
tree | b6baf4fa1aacd49304075b00765e70c8ff0eb3fe /contrib/package/uhttpd/src/uhttpd-lua.c | |
parent | 66ffcefa5555b35fc2e71429d9be16ac6de82801 (diff) |
uhttpd:
- rework url parsing and path resolving
- handle more cgi quirks
- change request dispatching
- clean up cflags
Diffstat (limited to 'contrib/package/uhttpd/src/uhttpd-lua.c')
-rw-r--r-- | contrib/package/uhttpd/src/uhttpd-lua.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/contrib/package/uhttpd/src/uhttpd-lua.c b/contrib/package/uhttpd/src/uhttpd-lua.c index 79fb76770..b2ca34e0c 100644 --- a/contrib/package/uhttpd/src/uhttpd-lua.c +++ b/contrib/package/uhttpd/src/uhttpd-lua.c @@ -1,6 +1,6 @@ #include "uhttpd.h" -#include "uhttpd-lua.h" #include "uhttpd-utils.h" +#include "uhttpd-lua.h" static int uh_lua_recv(lua_State *L) @@ -196,6 +196,7 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L) { int i; char *query_string; + const char *prefix = cl->server->conf->lua_prefix; const char *err_str = NULL; /* put handler callback on stack */ @@ -237,12 +238,19 @@ void uh_lua_request(struct client *cl, struct http_request *req, lua_State *L) lua_pushstring(L, query_string + 1); lua_setfield(L, -2, "query_string"); - lua_pushlstring(L, req->url, (int)(query_string - req->url)); - lua_setfield(L, -2, "path_info"); + if( (int)(query_string - req->url) > strlen(prefix) ) + { + lua_pushlstring(L, + &req->url[strlen(prefix)], + (int)(query_string - req->url) - strlen(prefix) + ); + + lua_setfield(L, -2, "path_info"); + } } - else + else if( strlen(req->url) > strlen(prefix) ) { - lua_pushstring(L, req->url); + lua_pushstring(L, &req->url[strlen(prefix)]); lua_setfield(L, -2, "path_info"); } |